iterating over the list
my_list = ['abc','def','ghi','jkl']
print('using for loop to iterate with the list elements')
for each_elem in my_list:
print(each_elem)
Iterate over list – mixed data types
my_mixed_list = ['my','string','list',1,2,3.14j,4.0]
print(f'This list has {len(my_mixed_list)} elements\nElements: {my_mixed_list}')
index = 1
print('Iterating thru each element')
for each_element in my_mixed_list:
# looping thru each element
print(f'value({each_element}),\ttype({type(each_element)}),\tposition[{index}]')
index = index + 1 # incrementing the index positions