--Originally published at Ed_Alita
Creating a Module
This is the 2nd part of my last post. In a new document of phyton we are goig to create a module or librarie. Therefore the first thing to do is to define a funtion and what does the funtion have to do.
The next exmaple is on how to get the fibonnacci serie.
This is a very simple example:
In this second case is the same only it put the result in a list:
Then we save it as Fibo.py
Using it
Now we go to cywin or your compiler.
- We got to the location of our programs.
- Next we put python3 and presss enter.
- Then we import the Fibo archive.
- Then we put Fibo.fib(10) With this we are calling a funtion that is inside of Fibo.
The information mentionted in this archive is in the next link
https://docs.python.org/2/tutorial/modules.html