Passing a range into a function passes with incorrect solution


#1

The problem asks you to return [0, 1, 2] however if you use print my_function(range(0,3)) then you will return [0, 2, 4] and the lesson will pass. I really want to upgrade to premium but the Python lessons are so broken I’m not sure it is worthwhile.


#2

Please remember to include a link to the exercise when posting a question in the Q&A. Thanks.


#3

https://www.codecademy.com/en/courses/learn-python/lessons/lists-and-functions/exercises/passing-a-range-into-a-function


#4

On line 6, replace the ____ with a range() that returns a list containing [0, 1, 2]

my_function should return [0, 2, 4], as expected. The above refers to the range function returning a list [0, 1, 2].

my_function(range(3))

or

my_function(range(0, 3))

#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.