DEV Community

Discussion on: 30 Days of Python 👨‍💻 - Day 4 - Data Types III

Collapse
 
kobbyknight profile image
KobbyKnight
list(range[10])

returns list index out of range. Does not generate any list for me.

list(range(0,5))

this does not work either. Returns list object is not callable...

Collapse
 
arindamdawn profile image
Arindam Dawn

Thank you for pointing that out. There was a typo in my post. I have rectified it now.

The first one should be list(range(10))

The second one should work fine. Where are you trying to evaluate this?
Generally, list index out of range occurs if we try to access an element in a list which is not present.

Collapse
 
sunny521012 profile image
sunny521012

Yes it works