initialValues = input('Please enter a space separated set of values for y, h and g(0): ')
values = []
values.append(initialValues)
theValues = []
for item in values:
item = item.split(' ')
for index in range(len(item)):
item[index] = int(item[index])
theValues.append(item)
y = theValues[0][0]
h = theValues[0][1]
g0 = theValues[0][2]
def Sumrecur(y,h,g0):
if y == 0 :
return g0
else:
sum = 0
for k in range(1,y):
sum = sum + Sumrecur(k,h,g0)*h
return sum
Sumrecur(y,h,g0)
this is a function i'm currently working on. I'm confused as the return sum command doesn't work. Is there anything wrong with the code?? Sorry it might sound silly to some of you but I really don't know how to fix this. thanks before!
y,h,g0 = map(int,raw_input('INPUT ').split(' '))should suffice .