-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcargame.py
37 lines (30 loc) · 864 Bytes
/
cargame.py
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
started = False
game_on = True
while game_on == True
command = input(">")
if command == ("help"):
print('''
Commands:
start -> to start the car
stop -> to stop the car
quit -> to exit
''')
elif command == ("start"):
if started:
print("Car already started!")
started = True
elif not started:
print("Car starting...")
started = True
elif command == ("stop"):
if started:
print("Car stopping...")
started = False
elif not started:
print("Car already stopped!")
started = False
elif command == ("quit"):
game_on = False
break
else:
print ("Sorry, that is not a command. Please refer to the 'help' command for further details.")