31.0k views
0 votes
Write a for loop to print the numbers from 35 to 45, inclusive (this means it should include

both the 35 and 45). The output should all be written out on the same line.
Expected Output
35 36 37 38 39 40 41 42 43 44 45

User NSGod
by
5.1k points

1 Answer

7 votes

Answer:

for num in range(35, 46):

print(num, end=' ')

or

num = 35

while num <= 45:

print(num, end=' ')

num += 1

User Mankarse
by
4.9k points