+ 11
What is the use of 'chain' function in itertools in python?
Can you demonstrate with an example?
8 Respostas
+ 4
I have made a code you can check it out:)
https://code.sololearn.com/c1Y632q5Kj2b/?ref=app
If you feel difficulty in understanding the difference between iterator and iterable then you can check this link:)
https://www-geeksforgeeks-org.cdn.ampproject.org/v/s/www.geeksforgeeks.org/JUMP_LINK__&&__python__&&__JUMP_LINK-difference-iterable-iterator/amp/?amp_js_v=a2&_gsa=1&usqp=mq331AQA#referrer=https%3A%2F%2Fwww.google.com&_tf=From%20%251%24s&share=https%3A%2F%2Fwww.geeksforgeeks.org%2Fpython-difference-iterable-iterator%2F
+ 8
Ayush Sinha Thank you so much, I understood now!đ€đđđđ€
+ 3
SWETA Xđ„, đđđđđ
+ 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
+ 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
0
Why you're using itertools for joining two list?..
We can do it simply with list.append..
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?