def contact(): print("hellomay")def contact2(): print("hellochris") def factorial(n): if n==1: return(1) else:return(n*factorial(n-1)) print(factorial(5)) x = factorial(6) print(x)...

1 answer below »





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=""><>






print(1 == a <>


















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
















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="">

Answered Same DayNov 13, 2022

Answer To: def contact(): print("hellomay")def contact2(): print("hellochris") def factorial(n): if n==1:...

Vikas answered on Nov 13 2022
58 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here