Whats going on here


#1

I'm struggling to understand the example they gave. I understand everything until the line where it defines the variable small. Im at a loss...im (lost) u could say. ehehehe.

def count_small(numbers):
total = 0
for n in numbers:
if n < 10:
total = total + 1
return total

lost = [4, 8, 15, 16, 23, 42]
small = count_small(lost)
print small


#2

calling count_small function on the list lost will return(give you a value that is) the number of elements in the list.
They are just capturing(storing) that result in the variable small and then they print that variable.

you print the result without using the variable small in which case you can just do

#replace these lines
small = count_small(lost)
print small

#with
print count_small(lost)

#3

Thanks for your help the actual problem was that I didn't understand arguments and thought that (lost) was a completely different argument being added on, but I got it now thanks anyways. :smiley: :smile: