def eval(n):
return n[0] + eval(n[1:]) if n else 0
list = []
idx = int(input("How many elements will you append?: "))
for i in range(idx):
tmp = int(input("Enter a number: "))
list.append(tmp)
print("The sum of the list is:",eval(list))
5.3m questions
6.9m answers