I'm a bit new to coding and I have a school project where we have to make a code using python, in the code we get an input from the user and need to add it together in a list, this is the code:
x = input("Enter the expenses: ")
y = x.split()
n = sum(y)
print("Total: $"+ n +"")
I have looked all over the internet and apparently this is correct but for some reason I always get an error saying:
Traceback (most recent call last):
File "program.py", line 3, in <module>
n = sum(y)
TypeError: unsupported operand type(s) for +: 'int' and 'str'
What am I doing wrong?