-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFlip Flop Game.py
More file actions
27 lines (18 loc) · 851 Bytes
/
Flip Flop Game.py
File metadata and controls
27 lines (18 loc) · 851 Bytes
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
# This little flip flop game is a great example of how the conditional while-loop works.
# The 'else' statement executes/runs when the user types the wrong keys, and the
# while-loop iterates/repeats over again while ignoring the 'break' statement.
print('\nWelcome to the Flip Flop Game')
print('\nPlease type the words "flip" or "flop", then press (ENTER)')
print('\nWhen you get bored, press (ENTER) to quit playing Flip Flop')
while True:
flip_flop=input('\nFlip? or Flop? ').strip()
if flip_flop=='flip':
print('\nFlop')
elif flip_flop=='flop':
print('\nFlip')
elif flip_flop=='':
print('\nThanks for playing Flip! Flop!')
break
else:
print('\nYou can\'t cheat now! Do you flip? or do you flop?')
input('\nEnd of program. Press Enter to quit.')