Help with the Range function

I’m trying to solve this question:

Modify list1 so that it is a range containing numbers starting at 0 and up to, but not including, 9.

Here is what I wrote:

list1 = range(0, 9)
print(list1)

Not sure why this isn’t working

Is this in Python2 or 3? In Python3 range returns a range object. If you wanted a list you’d need to change it to one, e.g. with list().

1 Like

@tgrtim - I’m not sure, below is a link to the exercise.

https://www.codecademy.com/paths/computer-science/tracks/cspath-flow-data-iteration/modules/dspath-lists/lessons/create-python-list/exercises/range-i

@tgrtim - That ended up working thank you!

1 Like