CBSE Class 12 Computer Science Question 80 of 105

Python Revision Tour — Question 6

Back to all questions
6
Question

Question 2e

Predict the output of the following code fragments:

for x in [1,2,3,4,5]:
    print (x)
Answer
Output
1
2
3
4
5
Explanation

x will be assigned each of the values from the list one by one and that will get printed.