Knowee
Questions
Features
Study Tools

What is the output of the following for loop and range() function?for num in range(2,-5,-1): print(num, end=", ")Options: Pick one correct answer from below2, 1, 0,2, 1, 0, -1, -2, -3, -4, -5,2, 1, 0, -1, -2, -3, -4,2, 1, 0, -1,

Question

What is the output of the following for loop and range() function?for num in range(2,-5,-1): print(num, end=", ")Options: Pick one correct answer from below2, 1, 0,2, 1, 0, -1, -2, -3, -4, -5,2, 1, 0, -1, -2, -3, -4,2, 1, 0, -1,

🧐 Not the exact question you are looking for?Go ask a question

Solution

The correct answer is: 2, 1, 0, -1, -2, -3, -4,

Similar Questions

What will be the output of following Python code snippet?for i in range(0 , -2 , -1): print(i)0,-10, -1, -1-1, -2Error

What is the output of the following Python code?for i in range(5,0,-1):    print(i)5 4 3 2 11 2 3 4 55 5 5 5 51 1 1 1 1

What will be printed by the following code?for i in range(5):    for j in range(5, 0, -1):        if i == j:            print(i, end=" ")1 2 3 44 3 2 1 004

What will the output of the following line of code be?print(list(range(10, 1, -1)))

What will be the output of the following code?for i in range(1,5): if i == 3: continue else: print(i,end = " ")Options: Pick one correct answer from below1 2 3 41 2 41 2 3 4 51 2

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.