Find the output of the following python code - for x in range (1,20,5) print(x)
Answers
Answered by
6
Question:-
Find the output of the following code in Python.
Working Out:-
Given code,
for x in range(1,20,5)
print(x)
At first,
x=1
Output:- 1
x=x+5=6
Output:- 6
x=x+5=11
Output:- 11
x=x+5=16
Output:- 16
x=x+5=21 but 21>20
So, loop terminates
Output:-
1
6
11
16
Similar questions