Warning: The magic method Slickr_Flickr_Plugin::__wakeup() must have public visibility in /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php on line 152
‘#mastery14’ Articles at TC101 Fall 2015
Introduction to Programming Python and C++

Tag Archives: #mastery14

Create Modules / Using Modules

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

Masteries #13 and #14

Here’s my video of me explaining masteries#13 and #14 Enjoy.

Importing and using Python modules and Creating and using a Python module

Here are the Mastery 13 and 14 and here is the link to youtube https://www.youtube.com/watch?v=9PP6zh2gW4s

Mastery14

Creating your own and using C++ libraries

Here is the link to my video:

Mastery14 – Creating Python modules

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)

Masteries 13 & 14

Masteries 13 & 14

What should you work on?

Week #12 and more partial exams for you.

For this week's readings:
C++ (TC1017) should either be looking at support for your project, ImageMagick C++ libraries are a good start.
Python (TC1014) should be finishing chapter 11 (Dictionaries).