CBSE Class 12 Computer Science Question 77 of 105

Python Revision Tour — Question 3

Back to all questions
3
Question

Question 2b

Predict the output of the following code fragments:

x = 10
y = 0
while x > y: 
   print (x, y)
   x = x - 1
   y = y + 1
Answer
Output
10 0
9 1
8 2
7 3
6 4
Explanation
xyOutputRemarks
10010 01st Iteration
9110 0
9 1
2nd Iteration
8210 0
9 1
8 2
3rd Iteration
7310 0
9 1
8 2
7 3
4th Iteration
6410 0
9 1
8 2
7 3
6 4
5th Iteration