33.3k views
5 votes
PLEASE HELP!

Question # 1 Fill in the Blank What is the output?
for num in range(3):
print (num + 5)

1 Answer

1 vote

Answer:

The output is :

5

6

7

Step-by-step explanation:

Given

The above lines of code

Required

What is the program output

The above code is python

This line implies that n has range of values from 0 to 2

for num in range(3):

This adds 5 to num and prints the result

print (num + 5)

So, when num = 0; 5 is printed because 0 + 5 = 5

So, when num = 1; 6 is printed because 1 + 5 = 6

So, when num = 2; 7 is printed because 2 + 5 = 7

Hence, the output is

5

6

7

With each number printed on a separate line

User Pribeiro
by
5.9k points