## Blog Detail

### Python Loops Exercises

• Write a Python program using a for loop to print the numbers from 1 to 5.

```                ```# Print numbers 1 to 5 using a for loop
for num in range(1, 6):
print('')``````
• Complete this for loop .

```                ```for ''(0, 10):
print(num)``````
• What is the output of this code?

```                ```for num in range(0, 10):
print(num)``````
• Which numbers will be printed?

```                ```for num in range(0, 5):
print(num * 2)``````
• print numbers 10 to 20 in seperate lines. (including 20)

```                ```# Print numbers 10 to 20 using a for loop
for num in range(''):
print(num)``````
• Print each item of the list in a separate line.

```                ```# List of items
items = ['apple', 'banana', 'orange', 'grape', 'kiwi']

# Iterate over the list and print each item
for '':
print(item)``````
• Complete the code based on the scenario:

Suppose you are a teacher, and you have a list of student grades for a particular exam. You want to display each student’s grade to provide them with feedback.

```                ```# List of student grades
grades = [85, 92, 78, 88, 95]

for ''
• What is the output of this code?

```                ```num = 1

while num <= 5:
print(num)
num += 1``````
• What is the output of this code?

```                ```num = 5

while num >= 1:
print(num)
num -= 1``````
• What is the output of this code?

```                ```num = 1

while num < 5:
print(num)
num += 1``````
• ## Python Exercises for Loops

• If you've faced difficulties with these exercises, take a look at Loops Module on my Python course.

You can also share 'Python Loops' Exercises on your: 