0% found this document useful (0 votes)
70 views1 page

Simple Car Game Code

This document contains code for a simple text-based car game. The code defines start, stop, and quit commands to control an imaginary car engine and exit the game. It uses a while loop to continuously take user input and check the command, starting or stopping the engine simulation accordingly or exiting if quit is entered. Help text is also provided to explain the available commands.

Uploaded by

maxreger
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
70 views1 page

Simple Car Game Code

This document contains code for a simple text-based car game. The code defines start, stop, and quit commands to control an imaginary car engine and exit the game. It uses a while loop to continuously take user input and check the command, starting or stopping the engine simulation accordingly or exiting if quit is entered. Help text is also provided to explain the available commands.

Uploaded by

maxreger
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Code for simple cara game jeanson

start = 'engine start... brrrooooomm'


stop = 'engine stop......'
quite = 'leave.'
started = False
help = '''
start - engine start
stop - engine stop
quite - leave
'''
command = ""

while command != quite:


command = input('> ').lower()
if command == "start":
if started:
print('The car is already started!')
else:
started = True
print(start)
elif command == "stop":
if stop:
if not started:
print('Car is already stopped!')
else:
started = False
print(stop)
elif command == 'help':
print(help)
elif command == "quite":
print('exit byeeeeeeee...')
break
else:
print("I don't understand that..")

You might also like