Skip to content

Commit a15e127

Browse files
committed
Chapter 10
1 parent 1e527ff commit a15e127

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

C10_debug.py

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
"""
2+
program is meant to be a simple coin toss guessing game. The
3+
player gets two guesses
4+
5+
"""
6+
7+
import random
8+
9+
guess = ''
10+
while guess not in (1, 0):
11+
print('Guess the coin toss! Enter 1 for heads or 0 for tails:')
12+
guess = int(input())
13+
toss = random.randint(0, 1) # 0 is tails, 1 is heads
14+
if guess == toss:
15+
print('You got it!')
16+
else:
17+
print('Nope! Guess again!')
18+
guess = int(input())
19+
if toss == guess:
20+
print('You got it!')
21+
else:
22+
print('Nope. You are really bad at this game.')

0 commit comments

Comments
 (0)