each in python code example
Example 1: for each loop python 3
# 'foreach' in python is done using 'for'
for val in array:
print(val)
Example 2: python for each loop
fruits = ["apple", "banana", "cherry"]
for
x in fruits:
print(x)
# 'foreach' in python is done using 'for'
for val in array:
print(val)
fruits = ["apple", "banana", "cherry"]
for
x in fruits:
print(x)