# Python program for jumbled words game.
import random
def choose():
words = ['classic', 'independent', 'nostalgic', 'network',
'magazine', 'vidyalaya', 'circumstance', 'chandrayaan',
'leavorotatory','material','required']
pick = random.choice(words)
return pick
def jumble(word):
random_word = random.sample(word, len(word))
jumbled = ''.join(random_word)
return jumbled
def thank(p1n, p2n, p1, p2):
print(p1n, 'Your score is :', p1)
print(p2n, 'Your score is :', p2)
check_win(p1n, p2n, p1, p2)
print('Thanks for playing...')
def check_win(player1, player2, p1score, p2score):
if p1score > p2score:
print("winner is :", player1)
elif p2score > p1score:
print("winner is :", player2)
else:
, print("Draw..Well Played guys..")
# Function for playing the game.
def play():
p1name = input("player 1, Please enter your name :")
p2name = input("Player 2 , Please enter your name: ")
pp1 = 0
pp2 = 0
turn = 0
while True:
picked_word = choose()
qn = jumble(picked_word)
print("jumbled word is :", qn)
if turn % 2 == 0:
print(p1name, 'Your Turn.')
ans = input("what is in your mind? ")
if ans == picked_word:
pp1 += 1
print('Your score is :', pp1)
turn += 1
else:
print("Better luck next time ..")
print(p2name, 'Your turn.')
import random
def choose():
words = ['classic', 'independent', 'nostalgic', 'network',
'magazine', 'vidyalaya', 'circumstance', 'chandrayaan',
'leavorotatory','material','required']
pick = random.choice(words)
return pick
def jumble(word):
random_word = random.sample(word, len(word))
jumbled = ''.join(random_word)
return jumbled
def thank(p1n, p2n, p1, p2):
print(p1n, 'Your score is :', p1)
print(p2n, 'Your score is :', p2)
check_win(p1n, p2n, p1, p2)
print('Thanks for playing...')
def check_win(player1, player2, p1score, p2score):
if p1score > p2score:
print("winner is :", player1)
elif p2score > p1score:
print("winner is :", player2)
else:
, print("Draw..Well Played guys..")
# Function for playing the game.
def play():
p1name = input("player 1, Please enter your name :")
p2name = input("Player 2 , Please enter your name: ")
pp1 = 0
pp2 = 0
turn = 0
while True:
picked_word = choose()
qn = jumble(picked_word)
print("jumbled word is :", qn)
if turn % 2 == 0:
print(p1name, 'Your Turn.')
ans = input("what is in your mind? ")
if ans == picked_word:
pp1 += 1
print('Your score is :', pp1)
turn += 1
else:
print("Better luck next time ..")
print(p2name, 'Your turn.')