Re: [Tutor] enumerate over Dictionaries

2019-07-06 Thread Alan Gauld via Tutor
On 06/07/2019 05:28, Suhit Kumar wrote: > I have made the complete program but when I am compiling the program it is > showing errors. Can you please help to resolve this? > The code is in the file attached with this mail. And where are the errors? Do not expect us to run unknown code received ov

Re: [Tutor] enumerate over Dictionaries

2019-07-06 Thread Suhit Kumar
Hi, I have made the complete program but when I am compiling the program it is showing errors. Can you please help to resolve this? The code is in the file attached with this mail. On Fri, Jul 5, 2019 at 10:44 PM Animesh Bhadra wrote: > Thanks Alan and Mats for the explanation. > > On 05/07/19 1

Re: [Tutor] enumerate over Dictionaries

2019-07-05 Thread Animesh Bhadra
Thanks Alan and Mats for the explanation. On 05/07/19 19:57, Mats Wichmann wrote: On 7/4/19 3:53 PM, Alan Gauld via Tutor wrote: Does this means that the Dict is ordered? or it is implementation dependent? Neither, it means the items in a list always have indexes starting at zero. By pure co

Re: [Tutor] enumerate over Dictionaries

2019-07-05 Thread Mats Wichmann
On 7/4/19 3:53 PM, Alan Gauld via Tutor wrote: >> Does this means that the Dict is ordered? or it is implementation dependent? > > Neither, it means the items in a list always have indexes > starting at zero. > > By pure coincidence dictionaries in recent Python versions (since 3.6 > or 3.7???)

Re: [Tutor] enumerate over Dictionaries

2019-07-04 Thread Alan Gauld via Tutor
On 04/07/2019 18:02, Animesh Bhadra wrote: > Hi All, > My python version is 3.6.7 > I need help to understand this piece of code? > > rainbow ={"Green": "G", "Red": "R", "Blue": "B"} > # ennumerate with index, and key value > for i, (key, value) in enumerate(rainbow.items()): Lets unpick t from t

[Tutor] enumerate over Dictionaries

2019-07-04 Thread Animesh Bhadra
Hi All, My python version is 3.6.7 I need help to understand this piece of code? rainbow ={"Green": "G", "Red": "R", "Blue": "B"} # ennumerate with index, and key value fori, (key, value) inenumerate(rainbow.items()): print(i, key, value) This gives a output as always:- 0 Green G 1 Red R 2 Blu