Welcome to the Treehouse Community
Looking to learn something new?
gibran erlangga5,539 Points
how to solve this question (make an argument accepts iterable)?
Hi guys, I having difficulty in solving this problem. Any idea?
def first_4 = iterable
step 1 is asking you to write a function called first_4 that returns the first 4 of an iterable. so you need to do a slice.
return iterable[0:4:1] #the first number in the brackets('0') is the beginning of your slice; the second number is the end of your slice; and the third number is the step increment along the way, so 1 would mean that it will print out every number from the beginning of your slice to the end.