Modules are a very strong and powerful thing inside Python3 if you don’t know how to make one or even how to using here’s a video of how you can do it:D Here’s the video
Here’s my video of me explaining masteries#13 and #14 Enjoy.
Here are the Mastery 13 and 14 and here is the link to youtube https://www.youtube.com/watch?v=9PP6zh2gW4s
Creating your own and using C++ libraries
Here is the link to my video:
A custom module is just a python file with fiunctions in it. You can create a python file and put in the same location as the program where you are going to call it. Here is an example:
I will create a new file called mymodule.py
def banana(filename):
name = open(filename)
content = name.read()
list = content.split(” “)
print (list)
counter = 0
for i in list:
if i.lower() == “banana”:
counter += 1
print (counter)
def calculate_e(precision):
counter = 1
accumulative = 1
variable = 1
while True:
accumulative += variable*(1/counter)
variable = (1/counter)*variable
new = accumulative + variable*(1/counter)
if (new – accumulative) < precision:
break
counter += 1
return accumulative
And now i´m going to call that file just like if it were a module. This file is called file.py and is located in the same directory as mymodule.py:
import mymodule.py
a = mymodule.banana(“text.txt”) #You must have a file named “text” called “text”
b = mymodule.calculate_e(35)
print (a)
print(b)
2
2.71825
As you can see in file.py i used the functions inside of mymodule.py by calling them as if they were a module(well, it is a module now)