Range() in python 2.7 v. 3 -
just wondering how same functionality out of range() in python 2.7 in version 3?
in python 2.7:
>>> range(5) [0, 1, 2, 3, 4]
in python 3:
>>> range(5) range(0, 5)
i need list looks 1 above, restricted using python3 assignment...
thanks much!
simply this:
list(range(5)) => [0, 1, 2, 3, 4]
in python 3, range()
returns iterable of objects, it's easy convert list, shown above.
Comments
Post a Comment