So first of all im writing a program that will total up all of the values in a list / array and heres what i got so far
def go( ann ):
total = 0
for i in range(0,len(ann)):
total = total+ann[i]
return total
print ( go( [-99,1,2,3,4,5,6,7,8,9,10,12345] ) )
print ( go( [10,9,8,7,6,5,4,3,2,1,-99] ) )
print ( go( [10,20,30,40,50,-11818,40,30,20,10] ) )
print ( go( [32767] ) )
print ( go( [255,255] ) )
print ( go( [9,10,-88,100,-555,1000] ) )
print ( go( [10,10,10,11,456] ) )
print ( go( [-111,1,2,3,9,11,20,30] ) )
print ( go( [9,8,7,6,5,4,3,2,0,-2,-989] ) )
print ( go( [12,15,18,21,23,1000] ) )
print ( go( [250,19,17,15,13,11,10,9,6,3,2,1,-455] ) )
print ( go( [9,10,-8,10000,-5000,1000] ) )
now what i may belive is wrong is probably my code and has to do something with the range function?
anything will help on why i keep getting 'return' outside function
I have tried looking at other post but they didnt help too much