TheBrahminCoder - How to Implement For Loop in Python

In Python , You can use the for loop to iterate over a sequence (that is either a list. a tuple . a dictionary , a set or a string) and execute a set of statements once for each item in the sequence. Here is an example of how to use the for loop in Python :




This will output :




In this example, we have created a list of fruits and used the for loop to iterate over each item in the list and print it.

Comments

Popular posts from this blog

TheBrahminCoder - What is script tag and types of scripts

TheBrahminCoder - What is CSS and types of CSS