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":28443,"date":"2015-11-25T21:23:11","date_gmt":"2015-11-26T03:23:11","guid":{"rendered":"http:\/\/charliegdrummer.wordpress.com\/?p=393"},"modified":"2015-11-25T21:23:11","modified_gmt":"2015-11-26T03:23:11","slug":"masteries-13-and-14-modules","status":"publish","type":"post","link":"https:\/\/kenscourses.com\/tc101fall2015\/2015\/masteries-13-and-14-modules\/","title":{"rendered":"Masteries 13 and 14: Modules"},"content":{"rendered":"

Modules, what the heck are those things?<\/p>\n

In python, modules are independent files that contain functions. These functions can be called in the file you are importing the modules. It is an easy way to keep functions outside your files, and it’s very useful when creating large code files.<\/p>\n

To import a module into a file, guess what, you use import modulename<\/span>, yeah, as simple as that.<\/p>\n

From that file, you can use all the functions.<\/p>\n

Here is<\/p>\n

How to create a module<\/h3>\n

Since a module is justa file with only functions and statesments,so for your module you’d wish to have only those to make it easy.<\/p>\n

In my module I am going to have two functions, one for fibonacci, that can be seen in this QUIZ<\/a>, and one for getting the distance between two points, in this QUIZ<\/a>.<\/p>\n

So i just take the functions and store them in the file, just like this<\/p>\n

\"deffib\"\"defdist\"<\/p>\n

I chose to name the module fibdist, just as there:<\/p>\n

\"modulename\"<\/p>\n

And that’s it, I have just created my own module named fibdist!<\/p>\n

Import a module and use it<\/p>\n

As I said, to import is just, well, import and the name of the module WITHOUT the extension, in my case will be import fibdist<\/p>\n

\"modulename\"<\/a>
\n
<\/a><\/p>\n

My module is already set in my file, so now I want to create a proggram that asks the user if he wants to do a fibonacci test or to get the distance between two points,<\/p>\n

\"choice\"<\/p>\n

Then, I can do all my coding, if it is 1 is fibonacci, is 2 is distance and so on<\/p>\n

\"fibcalled\"\"distancecalled\"<\/p>\n

 <\/p>\n

So here is the important part, in order to use the functions see right there, in the lines 8 and 18, I am using the function from the modules<\/p>\n

To do that, the correct format is<\/p>\n

modulename.functionname(parameters)<\/p>\n

\"use\"<\/p>\n

The tricky part here is that you need to know what the name and the parameters of the function are in order to use them correctly.<\/p>\n

 <\/p>\n

As you can see, it is really easy, and with that you can use those functions anytime you need to, that’s why modules are awesomly powerfully great!<\/p>\n

As always<\/p>\n

Github code: Module<\/a><\/span><\/p>\n

Github code: file<\/a><\/span><\/p>\n

\"richard_dramatic\"<\/p>\n

 <\/p>\n

 <\/p>\n

\"\"<\/a> \"\"<\/p>\n","protected":false},"excerpt":{"rendered":"

Modules, what the heck are those things? In python, modules are independent files that contain functions. These functions can be called in the file you are importing the modules. It is an easy way to keep functions outside your files, and it’s very useful when … Continúa leyendo Masteries 13 and 14: Modules<\/span><\/a>\"\"<\/p>\n","protected":false},"author":191,"featured_media":28432,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,3],"tags":[39],"_links":{"self":[{"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/posts\/28443"}],"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\/191"}],"replies":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/comments?post=28443"}],"version-history":[{"count":1,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/posts\/28443\/revisions"}],"predecessor-version":[{"id":28444,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/posts\/28443\/revisions\/28444"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/media\/28432"}],"wp:attachment":[{"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/media?parent=28443"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/categories?post=28443"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/tags?post=28443"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}