Re: [Tutor] Variable Question

2016-11-20 Thread Bryon Adams
On 11/18/2016 08:16 PM, Alan Gauld via Tutor wrote: for index, item in enumerate(prefix): prefix[index] = item[1] I forgot about enumerate! That helped me clean up and actually finish my next exercise as I was having trouble working for my lists the way I was previously. Thank you ver

Re: [Tutor] Variable Question

2016-11-20 Thread Peter Otten
Bryon Adams wrote: > On 11/18/2016 08:16 PM, Alan Gauld via Tutor wrote: >> for index, item in enumerate(prefix): >> prefix[index] = item[1] >> >> > > I forgot about enumerate! That helped me clean up and actually finish my > next exercise as I was having trouble working for my lists the way

[Tutor] Generic dictionary

2016-11-20 Thread Thorsten Kampe
[Crossposted to tutor and general mailing list] Hi, I'd like to extend the dictionary class by creating a class that acts like a dictionary if the class is instantiated with a dictionary and acts like a "dictitem" ([(key1, value1), (key2, value2), ...]) if instantiated with a list (that is dic