Game Commands
def help():
print(
"""
start - to start the car
stop - to stop the car
quit - to exit
""")
def start():
print('Car started...')
def stop():
print('Car stopped...')
def other():
print('I don\'t understand')
command = ""
prevCommand = ""
while (command != 'quit'):
prevCommand = command
command = input('> ').lower()
if (command == 'help'):
help()
elif (command == 'start'):
if (prevCommand == 'start'):
print('The car has already started')
else:
start()
elif (command == 'stop'):
if (prevCommand == 'stop'):
print('The car has already stopped')
else:
stop()
elif (command != 'quit'):
other()