[Tutor] Dictionary Issue

Ltc Hotspot ltc.hotspot at gmail.com
Fri Aug 7 02:30:43 CEST 2015


Mark,

I'm following the instructor's video exercise, available  at
https://www.youtube.com/watch?v=3cwXN5_3K6Q.

View attached screen shot file, image file shows a copy of the
counter: cou[wrd] =cou.get(wrd,0) +1


Please, explain the differences in counter methods?


Hal

On Thu, Aug 6, 2015 at 4:53 PM, Mark Lawrence <breamoreboy at yahoo.co.uk>
wrote:

> On 06/08/2015 20:05, Ltc Hotspot wrote:
>
>> On my breath and soul, I did:
>>
>> Counter objects have a dictionary interface except that they return a zero
>> count for missing items instead of raising a KeyError
>> <https://docs.python.org/3/library/exceptions.html#KeyError>:
>>
>
> That's nice to know.  What do the rest of the methods on the class do?
>
> Please don't top post here, it makes following long threads difficult.
>>>>>
>>>>
> What did you not understand about the above?
>
> You obviously haven't bothered to read the link I gave you about the
>>> Counter class so I give up.
>>>
>>>
> If you'd read the entire write up why are you still wasting time with a
> loop to find a maximum that simply doesn't work, when there is likely a
> solution in the Counter class right in front of your eyes?
>
>
> --
> My fellow Pythonistas, ask not what our language can do for you, ask
> what you can do for our language.
>
> Mark Lawrence
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>


More information about the Tutor mailing list