Computer Science, asked by sumitramusib, 6 months ago

Function range(10,5,2) will yield an iterable sequence like​

Answers

Answered by XxmschoclatequeenxX
3

Answer:

  • So there are many types of objects which can be used with a for loop. ... Here is an iterator that works like built-in range function. ... list( yrange(5)) [0, 1, 2, 3, 4] >>> sum(yrange(5)) 10
Answered by poojan
38

Language used: Python Programming

Code:

for i in range(10, 5, 2):

    print(i)

Here, range() is an inbuilt function.

Output:

Prints Nothing

Reason:

In range() function, the first parameter deals with the starting point, the second one deals with the ending point (that acts as a check condition for iterable i) and the last one depicts the interval.

At the start, the range function checks the third parameter's sign, if the function contains 3 parameters. If it is positive, the second parameter, which is the ending one, should be greater than the start value to get something as output. If the sign is negative, the second number should be negative as that is what helps in satisfying the conditions in iterations.

As 2 is positive, but 5<10; it prints nothing.

If the third parameter is -2;

for i in range(10, 5, -2):

    print(i)

The output will be:

10

8

6

with the decrement of 2 till i<5 becomes true.

Learn more:

1) Printing all the palindromes formed by a palindrome word.

brainly.in/question/19151384

2) Indentation is must in python. Know more about it at :

brainly.in/question/17731168

Similar questions