CBSE Class 12 Computer Science Question 58 of 120

Review of Python Basics — Question 10

Back to all questions
10
Question

Question 9(ii)

Write the output of the following:

for i in [100, 200, 300]: 
    print(i)
Answer
Output
100
200
300
Explanation

The for loop iterates over each element in the list [100, 200, 300] using the in operator, and during each iteration, the variable i takes on the value of each element in the list. The print(i) statement then prints the value of i during each iteration of the loop.