December 2017
Beginner
412 pages
10h 8m
English
Writing and Running a Program, explained that in order to save code for later use, you can put it in a file with a .py extension, and it demonstrated how to run that code. Chapter 3, Designing and Using Functions, also included this function definition:
| | >>> def convert_to_celsius(fahrenheit: float) -> float: |
| | ... """Return the number of Celsius degrees equivalent to fahrenheit |
| | ... degrees. |
| | ... |
| | ... >>> convert_to_celsius(75) |
| | ... 23.88888888888889 |
| | ... """ |
| | ... return (fahrenheit - 32.0) * 5.0 / 9.0 |
| | ... |
Put the function definition for convert_to_celsius from Defining Our Own Functions, in a file called temperature.py. (You can save ...
Read now
Unlock full access