hisoka Posted April 27, 2015 Share Posted April 27, 2015 4.3. The range() Function If you do need to iterate over a sequence of numbers, the built-in function range() comes in handy. It generates lists containing arithmetic progressions: >>>>>> range(10)[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] The given end point is never part of the generated list; range(10) generates a list of 10 values, the legal indices for items of a sequence of length 10 When I used the same little piece of code in my python interpreter web console it gave me : >>> range(10) (0,10) and not [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] why? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now