Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Error in the preface

38 views
Skip to first unread message

Jack Thompson

unread,
Aug 14, 2015, 11:01:26 PM8/14/15
to Building Skills Books
The program in Section 1.6 on page 10 of the Python edition has a bug. The program calculates the probabilities of various scores when rolling two dice, however the probabilities are displayed as percentages but not scaled up appropriately. As a result all of the values are 100x smaller than they should be.

The simplest fix is

for n in range(2,13):
    print "%d: %.2f%%" % (n, 100.0*combo[n]/36.0)

Alternatively you could drop the percent signs.

Steven F. Lott

unread,
Aug 17, 2015, 12:54:49 PM8/17/15
to building-s...@googlegroups.com
Thanks. Additionally. It's all old Python and needs a complete overhaul. 

Sent from my iPhone
--
You received this message because you are subscribed to the Google Groups "Building Skills Books" group.
To unsubscribe from this group and stop receiving emails from it, send an email to building-skills-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages