def main():
import math
#the loop
choice=str(raw_input("Will you add an item to the list? Say 'yes' to add or 'no' once you're done"))
while choice== "Yes" or choice== "yes":
addItem=input("What is the item?")
additemP=input("How much does that cost?")
print(addItem + "---------------------$" + additemP)
choice=str(raw_input("Will you add an item to the list? Just say yes or no"))
if choice != "yes":
quit
total = sum(additemP)
print(total)
every time i end the loop my output of the list shows the items i named and their price, but i can not get the total to print out i only get an error message
TypeError: unsupported operand type(s) for +: 'int' and 'str' on line 14
I just started coding very recently and I'm not too sure what to do
loopshould be in themainfunction. If so please indent the code accordingly. If it isn't, then you can get rid of themainfunction as it does not do anything. - Xero Smithraw_input()implicitly converts user inputs to strings. Whileinput()accepts only numbers. Passing an input that cannot be interpreted as a number toinput()raisesNameError. Please redit the question to reflect the op's original meaning. - Xero Smith