-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpermutations.py
More file actions
44 lines (44 loc) · 1.42 KB
/
Copy pathpermutations.py
File metadata and controls
44 lines (44 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import random
def choose():
words=['hello','something','pricelist','laptop','computer','kindergarden','lavender','workaholic','python','players']
return(random.choice(words))
def jumbled(word):
return("".join(random.sample(word,len(word))))
def play():
print("Welcome to the jumbled words game")
pname1=input("Name of First player: ")
pname2=input("Name of Recond player: ")
coins1=0
coins2=0
turn=0
while(1):
if turn%2==0:
print(pname1,"'s turn")
picked=choose()
print(jumbled(picked))
word=input("Your Answer: ")
if picked==word:
coins1+=1
print("Correct Answer! Your score is :",coins1)
else:
print("Better Luck Next Time!")
c=int(input("Press 1 to continue and 0 to quit:"))
if c==0:
print("Thanks for playing")
break
else:
print(pname2,"'s turn")
picked=choose()
print(jumbled(picked))
word=input("Your Answer: ")
if picked==word:
coins2+=1
print("Correct Answer! Your score is :",coins2)
else:
print("Better Luck Next Time!")
c=int(input("Press 1 to continue and 0 to quit:"))
if c==0:
print("Thanks for playing")
break
turn+=1
play()