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

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831
{"id":27222,"date":"2015-11-24T09:07:00","date_gmt":"2015-11-24T15:07:00","guid":{"rendered":"http:\/\/kenscourses.com\/tc101fall2015\/?guid=0a2e8871ef82adcd4c17b306cfbbdc37"},"modified":"2015-11-24T09:07:52","modified_gmt":"2015-11-24T15:07:52","slug":"mastery14-creating-python-modules","status":"publish","type":"post","link":"https:\/\/kenscourses.com\/tc101fall2015\/2015\/mastery14-creating-python-modules\/","title":{"rendered":"Mastery14 – Creating Python modules"},"content":{"rendered":"

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)<\/span><\/span>
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<\/span><\/span>
And now i\u00b4m 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:<\/span><\/span><\/span><\/span>
import mymodule.py<\/span><\/span>
a = mymodule.banana(“text.txt”)  #You must have a file named “text”<\/span> called “text”<\/span><\/span>
b = mymodule.calculate_e(35)<\/span><\/span>
print (a)<\/span><\/span>
print(b)<\/span><\/span>
2<\/span><\/span><\/span><\/span>
2.71825 <\/span><\/span> <\/span><\/span>
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)<\/span><\/span><\/span><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"

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)<\/span><\/span>
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<\/span><\/span>
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:<\/span><\/span><\/span><\/span>
import mymodule.py<\/span><\/span>
a = mymodule.banana(“text.txt”)  #You must have a file named “text”<\/span> called “text”<\/span><\/span>
b = mymodule.calculate_e(35)<\/span><\/span>
print (a)<\/span><\/span>
print(b)<\/span><\/span>
2<\/span><\/span><\/span><\/span>
2.71825 <\/span><\/span> <\/span><\/span>
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)<\/span><\/span><\/span><\/span><\/p>\n","protected":false},"author":198,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,3],"tags":[647,214,249],"_links":{"self":[{"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/posts\/27222"}],"collection":[{"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/users\/198"}],"replies":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/comments?post=27222"}],"version-history":[{"count":1,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/posts\/27222\/revisions"}],"predecessor-version":[{"id":27223,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/posts\/27222\/revisions\/27223"}],"wp:attachment":[{"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/media?parent=27222"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/categories?post=27222"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/tags?post=27222"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}