def adding_report(var):
lists=[]
total=0
while True:
if var.isdigit():
total+=int(var)
int(var).append(lists)
elif var=="Q":
choice=input("For total 'T' , for all 'A'").upper
if choice=='T':
print(total)
break
elif choice=='A':
print(lists)
print(total)
break
else:
print("Invalid input")
while True:
var=input("Enter an integer or Quit 'Q' ")
if var.isdigit():
adding_report(var)
elif var=="Q":
adding_report(var)
break
else:
print("Invalid input")
I am trying to store the input that i got from the user. I need to store them in a one variable. I will show all the input when user wants it or i will sum up all of them and show the total result to a user. But i dont know how to store integers in a one variable.
The final list should be like this; input1 input2 input3
Total:input1+input2+input3