I'm trying to write a program where I have two lists & one dictionary:
dict = {'fruit1' : 'apple', 'fruit2' :'banana', 'fruit3':'cherry' ....and so on}
list1 = ['a','b','c','d','e'....]
list2 = ['fruit1', 'fruit2','fruit3'....]
I have a program which looks like this. [This is not right at all, but it helps represent what I'm trying to get as the result].
for obj1 in list1:
for obj_2 in list2:
print(obj1)
print(obj_2)
print(dict[obj_2])
My need is to loop this in a way where obj_2 changes every nth loop, but obj_1 changes every loop. How can I achieve this?
So my result would look like(considering nth loop is 3rd loop):
a
fruit1
apple
b
fruit1
apple
c
fruit1
apple
d
fruit2
banana
e
fruit2
banana
f
fruit2
banana
g
fruit3
cherry
.
.
.