Example of a basic for Loop in Python

python


In this example, we have a list called fruits that contains three elements: “apple”, “banana”, “cherry” and “date”. We use a for loop to iterate over each element in the list. On each iteration, the variable fruit takes the value of the current element, and we print it out. The output will be:


Each element in the list is printed on a separate line, demonstrating the iteration over the list using the for loop.

Powered by atecplugins.com