Following the definition of a module that was given earlier, you can now see that you have in fact been working with modules all along. Any valid .py file that you have created in this book is more or less a valid module.
In this section, though, we are going to be a bit more deliberate in how we create modules so that you can see how to define and import resources.
To recap, a valid Python module is any .py file containing valid Python code. This code could be variable definitions, functions, classes, methods, and so on. We are going to practice with a simple module that contains just one function.
Let's go ahead and create our first module.
In this exercise, we will create a module named calculator:
Module names should follow normal Python variable naming conventions. These include the following:
They should follow snake_case (lower_case_with_underscore). Some good module names would be module and another_module. The following are examples of bad...