Vote count:
0
im using 3.4.1, and im trying to make a sort of vending machine program for fun, but I tried to make an if/else statement, that I used on another program that runs fine, but I keep getting syntax errors. Heres my code:
if choice1 == '1':
print('2 Dollars Please')
elif choice1 == '2':
print('1 Dollar Please')
elif choice1 == '2':
print('1 Dollar Please')
elif choice1 == '2':
print('1 Dollar Please')
else:
print('Error')
I would appreciate it if you could help
asked 9 mins ago
2 Answers
Vote count:
0
Python needs four spaces as indention. Your second line has only three spaces so it produces an error.
answered 7 mins ago
Vote count:
-1
I think you are trying to do this:
if choice1 == '1':
print('2 Dollars Please')
elif choice1 == '2':
print('1 Dollar Please')
else:
print("Error")
answered 2 mins ago
My if else statement will not work right and I dont know whats wrong
Aucun commentaire:
Enregistrer un commentaire