This program is not working right. It seems to be unable to print the cars after "You have the following cars:"
How could I get the variables to change in the def game() section?
Here is a pastebin: http://pastebin.com/pjsuWRYs
import random
car1 = ("car1")
car2 = ("car2")
car3 = ("car3")
car4 = ("car4")
car5= ("car5")
car6 = ("car6")
car7= ("car7")
car8 = ("car8")
car9 = ("car9")
def game():
print ("You have the following cars:")
print (car1)
print (car2)
print (car3)
print (car4)
print (car5)
print (car6)
print (car7)
print (car8)
print (car9)
print ("You selected Grand Thief Auto")
gta = input ("To commit GTA type GTA")
if gta in ("gta", "Gta", "GTA", "a"):
chance = random.randint(0,100)
if chance <= 1:
print ("You stole a Bugatti Veryron")
car1 = ("Bugatti Veryron")
elif chance <= 5:
print ("You stole a Ferrari Spider")
car2 = ("Ferrari Spider")
elif chance <= 10:
print ("You stole a Audi Q7")
car3 = ("Audi Q7")
elif chance <= 15:
print ("You stole a BMW X6")
car4 = ("BMW X6")
elif chance <= 20:
print ("You stole a Jaguar X Type")
car5 = ("Jaguar X Type")
elif chance <= 25:
print ("You stole a Ford Mondeo")
car6 = ("Ford Mondeo")
elif chance <= 30:
print ("You stole a Audi A3")
car7 = ("Audi A3")
elif chance <= 35:
print ("You stole a Ford Fiesta")
car8 = ("Ford Fiesta")
elif chance <= 40:
print ("You stole a Skoda Octavia")
car9 = ("Skoda Octavia")
elif chance <= 100:
print ("You got caught!")
game()
game()