Python FOR


FOR statement

The FOR statement iterates over the items of a list or a string, in the order that they appear in the list or string.

Examples

>>> my_list = ['Learn', 'python', 'language']
>>> for n in my_list:
	print(n)
	
Learn
python
language

>>> my_list=['Learn','python','test','language']
>>> for n in my_list:
	print(n,len(n))
	
Learn 5
python 6
test 4
language 8
>>>