Skip to content

Commit a9c800c

Browse files
authored
Create ThreeMonteCup.py
Function Interaction, Udemy bootcamp
1 parent 161e5f6 commit a9c800c

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

ThreeMonteCup.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
def shuffle_list(mylist):
2+
from random import shuffle
3+
shuffle(mylist)
4+
return mylist
5+
6+
def player_guess():
7+
guess=''
8+
while guess not in ['0','1','2']:
9+
guess= input('Pick a number between 0, 1 or 2')
10+
return int(guess)
11+
12+
def check_guess(mylist, guess):
13+
if mylist[guess] == 'o':
14+
print('Correct guess')
15+
else:
16+
print('Wrong guess, sorry!')
17+
print(mylist)
18+
19+
#INITIAL LIST
20+
mylist= ['', 'o', '']
21+
22+
#SHUFFLED LIST
23+
mylist_mixed= shuffle_list(mylist)
24+
#USER GUESS
25+
guess= player_guess()
26+
#FINAL CHECK
27+
check_guess(mylist_mixed, guess)

0 commit comments

Comments
 (0)