+ 3
How to manipulate single items with multiple lists?
if I have 2 lists and I try to go through the lists simultaneously, how to write the proper code? i have list1=[1,2,3] and list2=[4,5,6], I try to run it with the for statement: for i in list: print("blabla",i,"blabla", and now I want to run it from list2 4, in the next line 5, and next one 6... it should look like this: blabla 1 blabla 4 blabla 2 blabla 5 blabla 3 blabla6 please help (*I am a beginner and I am trying to impress my wife :) )
5 Respuestas
+ 15
You can do it like this:
for i in range(3):
print("blabla", list1[i], "blabla", list2[i])
P.S. Where do you get wives impressed by coding... 🤔😁
+ 4
Kuba Siekierzyński
well - I am deeply impressed by your code. (-;
+ 3
... but maybe thanks to my age not your pray scheme.
... hachz...
+ 1
aaaa I get it now, will try it, thanks a lot.
P.S. Nowhere I guess... She showed me a photo and I said I'm gonna write it as a code, but I managed to screw up with the lists
+ 1
I didn't find this detail anywhere, tough I tried many times to handle this. Anyways, it worked, thanks Kuba.
I feel great I got it finally and I am more excited about it than my wife is...