I am currently taking the edx course for python beginners and this is the final coding assesment test. my code is the following and the error is in line 19 : elif report_type.upper().startswith("T"):
It is a syntax error but the break statement above makes it happen because i have removed it, along with the while True loop and it runs perfectly
Any assistance would be appreciated.
total= 0
numbers = "\nItems\n"
print('Report Types include ALL Items ("A") or Total Only ("T")')
while True:
report_type= input('Choose Report Type ("A" or "T"): ')
if report_type.upper().startswith("A"):
while True:
x=input('Input an integer to add to the total or "Q" to quit: ')
if x.isdigit()==True:
total += int(x)
numbers += x + "\n"
elif x.upper().startswith("Q"):
print(numbers)
print("\nTotal\n",total)
break
else:
print(x,"is invalid input")
break
elif report_type.upper().startswith("T"):
while True:
x=input('Input an integer to add to the total or "Q" to quit: ')
if x.isdigit()==True:
total += int(x)
elif x.upper().startswith("Q"):
print("\nTotal\n",total)
break
else:
print(x,"is invalid input")
break
else:
print(report_type,"is invalid input")
I am sorry for any indentation issues i had to do it with the spacebar.