I just started learning python after scheme. Is recursion like sum+=alist[0]+sumup(alist[1:])
not allowed? I get the error
TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'
The code:
m=int(input())
c=list(map(int,input().split()))
x,y=map(int,input().split())
sum=0
def sumup(alist):
global sum
if alist==[]:
return 0
else:
if sum<x:
sum+=alist[0]+sumup(alist[1:])
elif sum>=x:
return sum
elif sum>y:
return 0
sumup(c)
x
andy
suppose to mean to this function?