Exercise 8: For Loop

Python For Loop Exercises

Let’s check out some exercises that will help you understand Python’s For Loops better.

Exercise 8-a

Write a for loop so that every item in the list is printed.

You can start a for loop and write a print statement inside it.

for i in …:
    ….

for i in lst:
print(i)

Exercise 8-b

Write a for loop which print "Hello!, " plus each name in the list. i.e.: "Hello!, Sam"

You can add strings together with “+” sign.: “Hello!, ” + “Sam” = “Hello!, Sam”

for i in lst:
print("Hello!, " + i)

Exercise 8-c

Write a for loop that iterates through a string and prints every letter.

When you iterate through a string it will go through the letters as strings have indexing too.

for i in str:
print(i)

Need More Exercises?

Check out Holy Python AI+ for amazing Python learning tools.

*Includes 14 more programming languages, inspirational tools and 1-on-1 consulting options.
Umut Sagir
Finance & Data Science Professional,
Founder of HolyPython