209k views
2 votes
Which of the following function is incorrect?

A. range(0, 3.5)
B. range(10, 4, -1)
C. range(1, 3, 1)
D. range(2.5, 4.5)
E. range(1, 2.5, 4.5)

User Alexvassel
by
8.5k points

1 Answer

2 votes
D. range(2.5, 4.5)

The `range` function is often used in programming to generate a sequence of numbers within a specified range. However, in the context of most programming languages, including Python, the `range` function typically requires integer arguments for the start, stop, and step values. Using floating-point values like 2.5 and 4.5 might result in an error or unexpected behavior in the context of a `range` function.
User Ranjeet Ranjan
by
8.8k points

No related questions found