def contact():
print("hello
may")
def contact2():
print("hello
chris")
def factorial(n):
if n==1:
return(1)
else:
return(n*factorial(n-1))
print(factorial(5))
x = factorial(6)
print(x)
def
is_palindrome(str):
return str ==
str[::-1]
print(is_palindrome('hannah'))
print(is_palindrome('solo'))
print(is_palindrome('12321'))
a,b,c = 'a',123, [1,2,3,4,5]
print(a)
print(b)
print(c)
n = 3
str1 = "Hello World"
print(str1*n)
def capitalize(string):
return
string.title()
print(capitalize('hello world'))
print(capitalize('python one liners'))
a = 5
print(2 < a < 8)
print(1 == a < 3)
board = ['1','2','3','4','5','6','7','8','9']
def printboard():
print(board[0],'|',board[1],'|',board[2])
print('--+---+---')
print(board[3],'|',board[4],'|',board[5])
print('--+---+---')
print(board[6],'|',board[7],'|',board[8])
print()
def checkwinner():
# Returns True if there's a winner, False otherwise
if
board[0]==board[1]==board[2]:
print("We
have a winner!")
return True
else:
return False
printboard()
turn = 'X'
while not checkwinner():
space =
int(input("where do you want to go"))
board[space-1]=turn
printboard()
if turn =='X':
turn = 'O'
- Check that space is a number, and is valid (1-9)
- Check that space has not already been taken
- Fix the turn taking
- Check for all winners
- Check for a tie (and show that)
- Add in a "would you like to play again" loop
Bonus: Have the computer play O and take the 1st available space