Question #144

What is the output of the code snippet below?
a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
print(len(list(range(0, len(a), 3))))

The third parameter of the range() function being a step, range(0, len(a), 3)) will return [0, 3, 6, 9] . Its length is 4. (thepythonguru.com/python-builtin-functions/range)


Comment on Disqus:

Comment on Twitter:

Question difficulty: 🔵🔵🔵🔵🔵


Similar questions: