What will be the output of the following python code?
for i in range(6):
print(i)
A) 0 1 2 3 4 5
B) 1 2 3 4 5 6
C) 0 1 2 3 4
D) 1 2 3 4 5
Answer:
A) 0 1 2 3 4 5
Explanation:
The code uses a for loop to iterate over the range from 0 to 5 (inclusive), and it prints each value of i
in that range. Therefore, the output will be the numbers from 0 to 5, separated by spaces.