{"id":37616,"date":"2016-09-10T08:33:37","date_gmt":"2016-09-10T13:33:37","guid":{"rendered":"http:\/\/shiannescamilla.wordpress.com\/?p=570"},"modified":"2016-09-10T08:33:37","modified_gmt":"2016-09-10T13:33:37","slug":"creating-you-own-functions","status":"publish","type":"post","link":"https:\/\/kenscourses.com\/tc101fall2016\/syndicated\/creating-you-own-functions\/","title":{"rendered":"Creating you own functions"},"content":{"rendered":"<p class=\"syndicated-attribution\"><em> --Originally published at <a href=\"https:\/\/shiannescamilla.wordpress.com\/2016\/09\/10\/creating-you-own-functions\/\"><a href=\"https:\/\/shiannescamilla.wordpress.com\">Codebuster<\/a><\/a><\/em><br \/><\/p>\n<p>So as said before, functions are pretty useful, but what if we need one that does not come prepackaged? or even better, what if we <em>want\u00a0<\/em>to create one our own, its fairly simple.<\/p>\n<p>The first thing we need to do to start wrtting a function is define it, using &#8220;def&#8221; a space and the name you want to assign to your function. You want to be careful how you name your function, so it doesnt get mixed up with other values,<\/p>\n<p>Next you should write the parameters for your function between parentheses so like this:<\/p>\n<blockquote><p>def function1 (parameter):<\/p>\n<p>here you would write what you want your function should do<\/p><\/blockquote>\n<p>&nbsp;<\/p>\n<p>Here is an actual function to calculate the volume of a figure<\/p>\n<p><img class=\"alignnone size-full wp-image-571\" src=\"https:\/\/shiannescamilla.files.wordpress.com\/2016\/09\/function-atom.png?w=634\" alt=\"function-atom\"   \/><\/p>\n<p>Which would give back:<\/p>\n<p><img class=\"alignnone  wp-image-569\" src=\"https:\/\/shiannescamilla.files.wordpress.com\/2016\/09\/function-cyg.png?w=661&#038;h=109\" alt=\"function-cyg\" width=\"661\" height=\"109\" \/><\/p>\n<p>That&#8217;s as easy as it is, enjoy!<\/p><br \/>  <a rel=\"nofollow\" href=\"http:\/\/feeds.wordpress.com\/1.0\/gocomments\/shiannescamilla.wordpress.com\/570\/\"><img alt=\"\" border=\"0\" src=\"http:\/\/feeds.wordpress.com\/1.0\/comments\/shiannescamilla.wordpress.com\/570\/\" \/><\/a> <img alt=\"\" border=\"0\" src=\"https:\/\/pixel.wp.com\/b.gif?host=shiannescamilla.wordpress.com&#038;blog=115353408&%23038;post=570&%23038;subd=shiannescamilla&%23038;ref=&%23038;feed=1\" width=\"1\" height=\"1\" \/>","protected":false},"excerpt":{"rendered":"<p>&#8211;Originally published at Codebuster So as said before, functions are pretty useful, but what if we need one that does not come prepackaged? or even better, what if we want\u00a0to create one our own, its fairly simple. The first thing we need to do to start wrtting a function is define it, using &#8220;def&#8221; a &hellip; <a href=\"https:\/\/kenscourses.com\/tc101fall2016\/syndicated\/creating-you-own-functions\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Creating you own functions<\/span><\/a><\/p>\n","protected":false},"author":51,"featured_media":571,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,4],"tags":[156,33],"class_list":["post-37616","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blogs","category-syndicated","tag-programming-basics","tag-tc101"],"_links":{"self":[{"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/posts\/37616","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\/51"}],"replies":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/comments?post=37616"}],"version-history":[{"count":2,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/posts\/37616\/revisions"}],"predecessor-version":[{"id":38663,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/posts\/37616\/revisions\/38663"}],"wp:attachment":[{"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/media?parent=37616"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/categories?post=37616"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/tags?post=37616"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}