forked from parthbheda/pythoniffie
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcar_game.py
More file actions
27 lines (26 loc) · 712 Bytes
/
car_game.py
File metadata and controls
27 lines (26 loc) · 712 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
# Simple self-explanatory if-else based program to start/stop the car
is_started = False
while True:
command = input('>').lower()
if command == 'help':
print('''
start - to start the car
stop - to stop the car
quit - to exit
''')
elif command == 'start':
if not is_started:
is_started = True
print('Car started..ready to go!')
else:
print('Car already started!')
elif command == 'stop':
if is_started:
is_started = False
print('Car stopped.')
else:
print('Car already stopped!')
elif command == 'quit':
break
else:
print("I don't understand that...")