Class - 12 CBSE Computer Science Important Output Questions 2025
Predict the output of the following code fragments:
for p in range(1,10):
print (p)
Python
Python Control Flow
10 Likes
Answer
1
2
3
4
5
6
7
8
9
Working
range(1,10)
will generate a sequence like this [1, 2, 3, 4, 4, 5, 6, 7, 8, 9]. p will be assigned each of the values from this sequence one by one and that will get printed.
Answered By
6 Likes