What does the range() function in Python generate?
A. A sequence of integers
B. A random number
C. A floating-point number
D. A list of strings
Answer: Option A
Solution (By Examveda Team)
The range() function in Python generates a sequence of integers.When called with one argument, range(n) produces a sequence of integers from 0 up to (but not including) n. When called with two arguments, range(start, stop) produces a sequence of integers from start up to (but not including) stop. The range() function is commonly used in for loops to iterate over a sequence of numbers. It provides a convenient way to generate sequences of integers without needing to manually specify each individual value.
Join The Discussion