A Complete Beginner’s Introduction to Python
Let’s create our own module! For this we’ll need to:
- Come up with some functionality we want to encapsulate into a function.
- Save that function and any
importstatements it requires in a new file that ends with
- Open up the Python interpreter and import that file by running
filenameis the name of the file without the
.pyon the end.
- Run the function by entering in
filename.functioname()and entering any parameters it requires!