-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCarGame.py
More file actions
26 lines (26 loc) · 730 Bytes
/
CarGame.py
File metadata and controls
26 lines (26 loc) · 730 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
class CarGame:
command = ""
started = False
while True:
command = input("> ")
if command == "start":
if started:
print("Car is already started")
else:
started = True
print("Car started...")
elif command == "stop":
if not started:
print("Car is already stopped!")
else:
started = False
print("Car stopped.")
elif command == "help":
print("""start - to start the car
stop - to stop the car
quit - to quit """)
elif command == "quit":
break
else:
print("i can't understand that ")
CarGame()