I am trying to make a very basic account money reduction system The code i am using asks the user if he would like to buy the object which costs 200 bucks. The idea is that the $200 will be deducted from the variable named total but, for some reason, this is not working. I do not know if it is possible to nest the For loop in an if statement. Thank you for your time
`
total = 1500
print('Would you like to buy this item?')
print('It costs 100 bucks')
purchaseConfirm = input()
if purchaseConfirm == 'yes':
for num in range(200):
total = total `enter code here`-1 # Why is this thing not functioning???
print(total)
break
` Thanks again.
Aucun commentaire:
Enregistrer un commentaire