def adding_report(report = "T"): total = 0 numbers = "\nItems\n" print = input("Enter an integer, or 'Q'' to quit: ") while True: int_or_q = input("Enter an integer, or 'Q' to quit: ") if int_or_q.isdigit(): total += int(int_or_q) if report.startswith("A"): numbers += int_or_q + "\n" elif int_or_q.startswith("Q"): if report.startwith("A"): print(numbers + "\nTotal\n" + str(total)) else: print("\nTotal\n" + str(total)) break if report.startswith("T"): print("\nTotal\n" + str(total)) else: print(int_or_q, "is an invalid input, try again!") break adding_report(int_or_q) print() adding_report('A') adding_report('T')note that I didn't look into your code (i.e. if it is correct and do what it is supposed to do)
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs