forked from megliz2008/Python_Tutorial_Beginners_2019
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcar.py
More file actions
31 lines (27 loc) · 700 Bytes
/
car.py
File metadata and controls
31 lines (27 loc) · 700 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
28
29
30
# car game
def command_help():
print("""start - to start the car
stop - to stop the car
quit - to quit""")
car_started = False
command = ""
while True:
command = input("> ").lower()
if command == "help":
command_help()
elif command == "start":
if car_started:
print("Car is already started???")
else:
car_started = True
print("Car started")
elif command == "stop":
if not car_started:
print("Car is already stopped???")
else:
car_started = False
print("Car stopped")
elif command == "quit":
break
else:
print("I dom't understand that ...")