Yes, the range() function can generate a decreasing sequence by specifying a negative step value. The syntax for range() allows you to set the start, stop, and step parameters, where the step can be negative.
Here’s an example of generating a decreasing sequence:
for i in range(10, 0, -1):
print(i)
This will output:
10
9
8
7
6
5
4
3
2
1
In this example, range(10, 0, -1) starts at 10 and decrements by 1 until it reaches 1 (the stop value is exclusive).
