I am wondering if there is a way to repeat a function with different values in the code
I've asked my teacher, searched online, asked some peers and none have the answer
while cashChoice > 0:
cash1 = 200 + int(offer1)*50
cashorBox = input("Would you like the money or the box? You have been offered $" + str(cash1) + ". If you want money, press [m], if you want the box, press [b]")
if cashorBox == "m":
print("Congratulations, you get " + str(cash1) + "! The prize you could've won from the box was " + str(userBox) + ". See you!")
sys.exit
elif cashorBox == "b":
print("Ok... you will be offered another cash amount.")
cashChoice -= cashChoice
if cashChoice == 0:
print("Great! You may have the box. It contains " + str(userBox) + "! Farewell :)")
sys.exit
else:
continue
I want it to repeat but with different values of "cash1" as in "cash2"
cash2defined in your code.listin Python)? So you can have “variables” likecash[1],cash[2],cash[3], …?