From e1bd3bf12148ea463f1580490e2988f2f1f878cc Mon Sep 17 00:00:00 2001 From: Carol Willing Date: Mon, 21 Oct 2024 12:53:00 -0700 Subject: [PATCH] use the improved name with verb convert --- clean-modular-code/intro-clean-code.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/clean-modular-code/intro-clean-code.md b/clean-modular-code/intro-clean-code.md index ec8c07e..32a6508 100644 --- a/clean-modular-code/intro-clean-code.md +++ b/clean-modular-code/intro-clean-code.md @@ -158,12 +158,12 @@ Pythonic code communicates the programmer's intent clearly, making it easier for Note that the function below has an easy-to-understand name and clear docstring. Some people will even suggest adding a verb that explains what the function does, such as: -`convert_fahr_kelvin()` +`convert_fahrenheit_to_kelvin()` ```python editable=true slideshow={"slide_type": ""} -def fahrenheit_to_kelvin(temperature_fahr): +def convert_fahrenheit_to_kelvin(temperature_fahr): return ((temperature_fahr - 32) * (5 / 9)) + 273.15 ``` @@ -176,7 +176,7 @@ Documentation can mean many different things. When you are writing code, a combi Pythonic code reflects Python's emphasis on readability and simplicity. A well-known phrase from the **Zen of Python** is: "There should be one—and preferably only one—obvious way to do it," which is a core idea behind writing Pythonic code. ```python -def fahrenheit_to_kelvin(temperature_fahr): +def convert_fahrenheit_to_kelvin(temperature_fahr): """ Convert temperature from Fahrenheit to Kelvin.