+ 11

What is the use of 'chain' function in itertools in python?

Can you demonstrate with an example?

25th Jun 2019, 8:16 AM
SWETA X
SWETA X - avatar
8 Respostas
+ 8
Ayush Sinha Thank you so much, I understood now!đŸ€—đŸ˜ŠđŸ˜ŠđŸ˜ŠđŸ€—
26th Jun 2019, 12:36 PM
SWETA X
SWETA X - avatar
25th Jun 2019, 9:35 AM
Saksham Jain
Saksham Jain - avatar
+ 3
SWETA XđŸ”„, 😄😄😄👍👍
26th Jun 2019, 12:47 PM
Ayush Sinha
Ayush Sinha - avatar
+ 3
chain(list_a,list_b) returns an iterator which has items of first list and the second list after that. Its an option for you to use it for example when you have 2 big list and you don’t want to copy them in memory or lots of other uses... https://code.sololearn.com/cD3R3Vxp4Tk0/?ref=app
27th Jun 2019, 7:16 AM
Amir Motamedi
Amir Motamedi - avatar
+ 2
Pls i do have a quiz python program on my pc. The only problem that i have, is i do not know how to calculate total scores for the quiz program
26th Jun 2019, 4:25 AM
Chukwuebuka Ezeokeke
Chukwuebuka Ezeokeke - avatar
0
Why you're using itertools for joining two list?.. We can do it simply with list.append..
27th Jun 2019, 2:26 AM
Amit Dubey
Amit Dubey - avatar
0
So if use, For loop, to iterate each item in the 2nd list..and use list.append() to add it to the 1st list..will it use a lot of memory to do so?
27th Jun 2019, 7:06 PM
Amit Dubey
Amit Dubey - avatar