September 2013
Intermediate to advanced
350 pages
9h 38m
English
The built-in functions are useful but pretty generic. Often there aren’t built-in functions that do what we want, such as calculate mileage or play a game of cribbage. When we want functions to do these sorts of things, we have to write them ourselves.
Because we live in Toronto, Canada, we often deal with our neighbor to the south. The United States typically uses Fahrenheit, so we convert from Fahrenheit to Celsius and back a lot. It sure would be nice to be able to do this:
| | >>> convert_to_celsius(212) |
| | 100.0 |
| | >>> convert_to_celsius(78.8) |
| | 26.0 |
| | >>> convert_to_celsius(10.4) |
| | -12.0 |
However, function convert_to_celsius doesn’t exist yet, so instead we see this (focus only on the last line of ...
Read now
Unlock full access