In this Python for beginners tutorial we are going to learn the following:
How to create a Python module.
How to use a Python module.
In the previous videos, we learned how to create our own functions.
In this example program, we have a function that we created in a previous video that greets the user by his or her name. We also have the add function that calculates and returns the sum of two numbers and a function that returns the name of a given month.
At the beginning of our program, we have the function definitions and then we use these functions by calling them a few times each. As you can see when I hit the run button, the program works and prints out some messages.
As our programs becomes bigger, it becomes harder to follow what is happening. So, to make our code more readable, we are going to move our function definitions into a separate file, a module. So, the first thing we need to do is to create a new file. To create a new file, we have to click on this button, and then this button to create a new file. Let’s name the new file we are going to create my_module.py. The name of the file, is the name of the module.
#pythoncourse #pythontutorial #programmingwithnick
Watch video Create a Module - Python for Absolute Beginners Course online without registration, duration hours minute second in high quality. This video was added by user Programming With Nick 23 June 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 336 once and liked it 21 people.