[Tutor] Dictionary Question

Garry Bettle garry.bettle at gmail.com
Wed Dec 22 23:26:46 CET 2010


On Wed, 22 Dec 2010 23:31:39 +1100, Steven D'Aprano wrote:
> In this case, you need to sum the number of races for all the fixtures:
>
> num_races = sum(len(racetimes) for racetimes in FixtureDict.values())

Many thanks Steven for your explanation and final golden nugget of code.

On Wed, 22 Dec 2010 10:11:25 -0500, bob gailer wrote:
>
> Also note: len(dict.keys()) == len(dict.values()) == len(dict)

Yup, thanks Bob.

Cheers,

G.


More information about the Tutor mailing list