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":28173,"date":"2015-11-25T19:40:00","date_gmt":"2015-11-26T01:40:00","guid":{"rendered":"http:\/\/juansalvadorfernandez.wordpress.com\/?p=155"},"modified":"2015-11-25T19:40:00","modified_gmt":"2015-11-26T01:40:00","slug":"creating-and-calling-python-functions","status":"publish","type":"post","link":"https:\/\/kenscourses.com\/tc101fall2015\/2015\/creating-and-calling-python-functions\/","title":{"rendered":"Creating and calling Python functions"},"content":{"rendered":"

Functions are bits of reusable code meant to comply with a single task, such as calculating the value of \u201ce\u201d for example.<\/p>\n

Python already has some built-in functions, such as \u201cprint ()\u201d, but it also gives you the possibility to create your own.<\/p>\n

In order to define a function you use the command \u201cdef\u201d, then you need to name the function and give it a parameter to take in. Some functions can take in no parameters and still work.<\/p>\n

After that you tell the function what you want it to do, for example: \u201cx=1, y=2 \/ c=x+y \/ return c\u201d, this part here is very important, a function will ALWAYS return something, even if there are no values it will return the value \u201cNONE\u201d, with the return you can specify which value you want to have as a result, but more importantly \u201creturn\u201d marks the end of a function, so even if we have a while, but we mess up the indentation of the return and place it inside the while, it will make it so that the while runs only once and then it will kill it, kind of like a break.<\/p>\n

Once written function can be reused, or called, any number of times. The way in which you call a function is by writing its name and then fiving it a value for its parameter. For instance let\u2019s say that you have the function \u201cMultisumcation (x, y)\u201d, the way to call this function would be: \u201cMultisumcation (23, 45)\u201d, taking in 23 as the value for x and 45 as the value for y.<\/p>\n

You may fill up your function with whatever the hell you want, but be sure that it is properly indented and that you add the return statement at the end of it.<\/p>\n

There is another way to define a function, with the \u201clambda\u201d keyword instead of \u201cdef\u201d.<\/p>\n

This functions are called \u201cAnonymous functions\u201d and they have the following characteristics:<\/p>\n