KnowledgeBoat Logo

Computer Science

Find the output of the following:

for i in range(20, 30, 2):
    print (i)
    1.
21  
22  
23  
24  
25
    2.
21  
23  
25  
27  
29

3. SyntaxError
4.

20  
22  
24  
26  
28 

Python Control Flow

1 Like

Answer

20
22
24
26
28

Reason — The code uses a for loop with range(20, 30, 2), generating numbers from 20 to 28 with a step of 2. It iterates through these values, printing each number (20, 22, 24, 26, 28) on a new line.

Answered By

2 Likes


Related Questions