give output of Range(10,5,-1) in python
Answers
Answered by
1
Answer:
The output will begin from 10 and decrease to value 6.
Therefore the output is:
10
9
8
7
6
Answered by
5
Answer:
Output of range(10,5,-1) is -
>> 10, 9, 8, 7, 6
Example:
The starting value in this range function is - 10
The ending value is - 6 (5 is excluded)
So, range(10,5,-1) creates sequence from 10 to 6.
>> Output: 10, 9, 8, 7, 6
The third parameter is the step value. Step value is -1. So values in the sequence is decremented by 1 after each iteration.
Similar questions