Sep-01-2020, 09:11 PM
ok, this should work. See comments
list_nums= [i for i in range(15)] #your line def fn(ln): #ln will be list_nums but less confusing scope output = [] #because you want all the numbers at once for i in ln: #proper for loop. Anything with range(len(anything)) there is a better way if i<9: output.append(i) #add to list return output #this is what you return, not a single value print(fn(list_nums))