We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
so what u have done here is created 3 copies of iterator
and the zip's index recognises this thing as 3 separate iterables
so the index would be the same for each iterable upon which the zipping has to be performed.
hence u re getting the same variable of the iterator as the result.
if u ve given like iter(s)*3 the zip's index would be updated(incremented) on proceeding to the succeeding iterable
(making zip to believe u have like only one iterable so dont go look for the other one to zip instead increment your index to the next variable on the same iterable.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Merge the Tools!
You are viewing a single comment's thread. Return to all comments →
so what u have done here is created 3 copies of iterator and the zip's index recognises this thing as 3 separate iterables so the index would be the same for each iterable upon which the zipping has to be performed. hence u re getting the same variable of the iterator as the result. if u ve given like iter(s)*3 the zip's index would be updated(incremented) on proceeding to the succeeding iterable (making zip to believe u have like only one iterable so dont go look for the other one to zip instead increment your index to the next variable on the same iterable.