What are range and xrange?
Answer / Ravi Kiumar
Both `range()` and `xrange()` generate a sequence of integers, but they differ in how the values are generated. `range()` generates a list with all the values at once, while `xrange()` generates the values on-the-fly (without storing them in memory).nn```pythonnlist_range = list(range(5)) nxrange_obj = xrange(5)nprint(list_range) # Output: [0, 1, 2, 3, 4]nprint(list(xrange_obj)) # Output: [0, 1, 2, 3, 4]
| Is This Answer Correct ? | 0 Yes | 0 No |
What is an elif in python?
What is the tool used to check python code standards?
What is python and why python?
What does exit () do in python?
Which is the invalid variable assignment from the below?
Does python have polymorphism?
Tell me is there a switch or case statement in python?
How do I use python idle?
What are class attributes in python?
Is compiled python faster?
Can you hack with python?
What is the with statement in python?