I am a novice in Python.. And I have a code here:
while True:
report_type = input("Choose Report Type ('A' or 'T'): ")
if report_type == "A":
total = 0
items = ""
while True:
enter_int = input("Enter an integer or \"Q\": ")
if enter_int.lower():
if enter_int == "Q":
print("\nItems",items,"\n")
print("Total","\n",total,"\n")
break
else:
items = items + "\n" + enter_int
total = total + int(enter_int)
else:
print("Invalid Input")
elif report_type == "T":
total = 0
while True:
enter_num = input("Enter an integer or \"Q\": ")
if enter_num.lower():
if enter_num == "Q":
print("\nTotal","\n",total,"\n")
break
else:
total = total + int(enter_num)
else:
print("Invalid Input")
else:
print("Invalid syntax")
adding_report()
And I want the "total = 0 and items = """ variable to declare inside the function of "def adding_report(report)" and has a one parameter report. I am really stuck about this one because I am new to Python.
Thank you so much for the help.
Aucun commentaire:
Enregistrer un commentaire