cnolmsted / git_notes

0 stars 0 forks source link

binomial.py exercise by Charles Olmsted #5

Open cnolmsted opened 5 years ago

cnolmsted commented 5 years ago

binomial.py

This script can be run from the command line from any directory that contains it by ./binomial.py Also it can be imported into python to run any of the defined modules To see options and rules, run either$ ./binomial.py --help or in python import binomial help(binomial)

git commit containing the script:

ee750898c71defc82d824365844a40b4f243655b

tags

@cecileane @coraallencoleman

cecileane commented 5 years ago

awesome, Charles. I like how you used try / except to accept an integer given as a string, how you put this into a separate function :+1:

round(result) would have been better than int(result) because int could convert rounding errors wrongly, like this below (14 instead of 15):

>>> int(14.9999999)
14