CBSE Class 12 Computer Science Question 87 of 105

Python Revision Tour — Question 13

Back to all questions
13
Question

Question 2l

Predict the output of the following code fragments:

x = 'one'              
y = 'two'              
counter = 0            
while counter < len(x):
    print(x[counter], y[counter])
    counter += 1
Answer
Output
o t
n w
e o
Explanation

Inside the while loop, each letter of x and y is accessed one by one and printed.