Today I was writing a while loop code in python3 here is the code:
#Simulate supermarket billing process
while True:
total=0
repeat="y"
Noc=input("Enter customer's name here:")
while repeat=="y":
print("1. Keep adding.")
print("2. Print the bill amount.")
choice=int(input("Enter your choice(1 or 2):")
if choice==1 or choice==2:
if choice==1:
itemqty=int(input("Etner item quantity here:"))
itemamt=float(input("Enter item price Here:"))
total=total+itemqty*itemamt
elif choice==2:
print("The total amount is:",total)
repeat=input("Do you want to enter more items?(Y/y/N/n)")
else:
print("Incorrect choice...Enter again")
#print a bill
print("Name:"," ",Noc,)
print("Total Amount:"," ", total)
print("-----**Thanks for Shopping**-----")
mp=input("Want to go to next person?(Y/y/N/n)")
if mp="N" or mp="n":
break
And this error is coming
File "/home/agupta/Documents/anant/codingPlayground/learnPython/Chapter 4/hi.py", line 10
if choice==1 or choice==2:
^
Syntax Error: invalid syntax
Please could someone tell what is the error?
Aucun commentaire:
Enregistrer un commentaire