Going through the D&D Character exercise (D&D Character), I get to the last test script, Random_Ability_Is_Distributed_Correctly, why is actualDistribution is set to expectedDistribution, then actualDistribution is zeroed out?
why is actualDistribution is set to expectedDistribution, then actualDistribution is zeroed out?
It is just a short way to create another dict with the same keys (possible dice values 3-18), and all their values set to zero. Then their actual value (times each dice value being rolled) is increasing using the for loop just below.
And at the end, each of the key and its value in actual distribution is being tested against the range of expected distribution key and its value.
That works. Thanks.