{"id":37609,"date":"2016-09-12T07:56:25","date_gmt":"2016-09-12T12:56:25","guid":{"rendered":"http:\/\/firstprogrammingsteps.wordpress.com\/?p=168"},"modified":"2016-09-12T07:56:25","modified_gmt":"2016-09-12T12:56:25","slug":"functions-in-python-4","status":"publish","type":"post","link":"https:\/\/kenscourses.com\/tc101fall2016\/syndicated\/functions-in-python-4\/","title":{"rendered":"Functions in python"},"content":{"rendered":"<p class=\"syndicated-attribution\"><em> --Originally published at <a href=\"https:\/\/firstprogrammingsteps.wordpress.com\/2016\/09\/12\/functions-in-python\/\"><a href=\"https:\/\/firstprogrammingsteps.wordpress.com\">Hackerman&amp;#039;s house<\/a><\/a><\/em><br \/><\/p>\n<p>A function is a structuring element that groups some lanes of code that can be utilized many times in the program. Is basically defining a formula to then just put the name of the formula, and the program will run it without the need of writing it again.<\/p>\n<p>The syntax looks like this.<\/p>\n<blockquote><p>def name-of-the-function(Parameters):<\/p>\n<p>Statements<\/p><\/blockquote>\n<p>The statements determine what your function will do.<\/p>\n<p>To call a function you just need to put the name of a function previously defined.<\/p>\n<blockquote><p>name-of-the-function()<\/p><\/blockquote>\n<p>This is a really simple example about how to define a function and then call it two times. What this would do is run the same function two times. It is important to note that this function has no parameters.<\/p>\n<p><img class=\"alignnone size-full wp-image-180\" src=\"https:\/\/firstprogrammingsteps.files.wordpress.com\/2016\/09\/function.jpg?w=736\" alt=\"function\"   \/><\/p>\n<p>And this is how the program works.<\/p>\n<p><img class=\"alignnone size-full wp-image-186\" src=\"https:\/\/firstprogrammingsteps.files.wordpress.com\/2016\/09\/function2.jpg?w=736\" alt=\"function2\"   \/><\/p>\n<p>Besides this really simple program I created another that actually uses parameters.<\/p>\n<p><img class=\"alignnone size-full wp-image-189\" src=\"https:\/\/firstprogrammingsteps.files.wordpress.com\/2016\/09\/function4.jpg?w=736\" alt=\"function4\"   \/><\/p>\n<p>This program executes a sum of the two parameters given.<\/p>\n<p>And here it is how it works.<\/p>\n<p><img class=\"alignnone size-full wp-image-190\" src=\"https:\/\/firstprogrammingsteps.files.wordpress.com\/2016\/09\/function5.jpg?w=736\" alt=\"function5\"   \/><\/p>\n<p>Thanks for reading me.<\/p><br \/>  <a rel=\"nofollow\" href=\"http:\/\/feeds.wordpress.com\/1.0\/gocomments\/firstprogrammingsteps.wordpress.com\/168\/\"><img alt=\"\" border=\"0\" src=\"http:\/\/feeds.wordpress.com\/1.0\/comments\/firstprogrammingsteps.wordpress.com\/168\/\" \/><\/a> <img alt=\"\" border=\"0\" src=\"https:\/\/pixel.wp.com\/b.gif?host=firstprogrammingsteps.wordpress.com&#038;blog=115170367&%23038;post=168&%23038;subd=firstprogrammingsteps&%23038;ref=&%23038;feed=1\" width=\"1\" height=\"1\" \/>","protected":false},"excerpt":{"rendered":"<p>&#8211;Originally published at Hackerman&amp;#039;s house A function is a structuring element that groups some lanes of code that can be utilized many times in the program. Is basically defining a formula to then just put the name of the formula, and the program will run it without the need of writing it again. The syntax &hellip; <a href=\"https:\/\/kenscourses.com\/tc101fall2016\/syndicated\/functions-in-python-4\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Functions in python<\/span><\/a><\/p>\n","protected":false},"author":22,"featured_media":180,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,4],"tags":[211,212,126,24,33],"class_list":["post-37609","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blogs","category-syndicated","tag-call","tag-define","tag-functions","tag-python","tag-tc101"],"_links":{"self":[{"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/posts\/37609","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/users\/22"}],"replies":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/comments?post=37609"}],"version-history":[{"count":3,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/posts\/37609\/revisions"}],"predecessor-version":[{"id":38156,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/posts\/37609\/revisions\/38156"}],"wp:attachment":[{"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/media?parent=37609"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/categories?post=37609"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/tags?post=37609"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}