I have a list and I want to put its elements inside a for loop string like this:
my_list = ["Germany", "England", "Spain", "France"]
for this in that:
do stuff
print(my_list[0]+ some other stuff)
The output should be like:
Germany + some other stuff
England + some other stuff
Spain + some other stuff
France + some other stuff
How can I loop the indices for string interpolation as well?
Thanks!
Edit: The loop is a bit different. It's more like this:
for foo in bar:
another_bar = []
for x, y in foo:
do stuff
a = object.method()
another_bar.append(my_list[0]+a)
I need to put the strings of lists into the 2nd layer of nested loop. Can't use zip here.
indexis not defined. Please refer to minimal reproducible example.