I want to input something like "g 1 2 3" repeatedly and have the numbers add to a variable each time I enter them. I made a test program however the output is wrong e.g. if I enter "g 1 2 3" 3 times I would expect my variable to print "3" but it prints "0". What is wrong with my code?
AddTot = int(0)
NameMarks = input("Please input your name followed by your marks seperated by spaces ")
NameMSplit = NameMarks.split()
while NameMarks != 'Q':
Name1 = int(NameMSplit[1])
Name2 = int(NameMSplit[2])
Name3 = int(NameMSplit[3])
AddTot + Name1
NameMarks = input("Please input your name followed by your marks seperated by spaces ")
print(AddTot)