Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

While using zip(a,b) funtion with dict() , it returns the value in key,value pair . How?

$
0
0
 a = ("John", "Charles", "Mike") b = ("Jenny", "Christy", "Monica") x = zip(a, b) #use the tuple() function to display a readable version of the result: print(dict(x))

Just got to know about zip() functions and knowing about I learnt that it returns zip object. Tested out using tuple() and list() to give it is readable form, returns in it as tuple for each element. But incase of dict() it returns in key-value pair. Would helpful for me get an explanation .


Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>