|
|
||||||
Conventions Used in This BookHere is a typical Code sample. Example 1. Typical Python Example combo = { }
1
for i in range(1,7):
for j in range(1,7):
roll= i+j
combo.setdefault( roll, 0 )
2
combo[roll] += 1
for n in range(2,13):
print "%d %.2f%%" % ( n, combo[n]/36.0 )
3
The output from the above program will be shown as follows: 2 0.03% 3 0.06% 4 0.08% 5 0.11% 6 0.14% 7 0.17% 8 0.14% 9 0.11% 10 0.08% 11 0.06% 12 0.03% Tool completed successfully We will use the following type styles for references to a specific
Sidebars When we do have a significant digression, it will appear in a sidebar, like this. TipThere will be design tips, and warnings, in the material for each exercise. These reflect considerations and lessons learned that aren't typically clear to starting OO designers. |
||||||