Google News
logo
Python Program to Loop through a List
Here's a Python program to loop through a list using a for loop :
Program :
fruits = ["apple", "banana", "cherry"]

for fruit in fruits:
    print(fruit)
Output :
apple
banana
cherry
In the above program, we have defined a list of fruits and used a for loop to iterate over each item in the list. The loop variable `fruit` takes on each value in the list `fruits` in turn, and the `print()` function is used to output the value of the variable `fruit` to the console.