{"id":38690,"date":"2016-10-28T17:13:02","date_gmt":"2016-10-28T22:13:02","guid":{"rendered":"http:\/\/sernap97.wordpress.com\/?p=99"},"modified":"2016-10-28T17:13:02","modified_gmt":"2016-10-28T22:13:02","slug":"importing-and-using-moduleslibraries-3","status":"publish","type":"post","link":"https:\/\/kenscourses.com\/tc101fall2016\/syndicated\/importing-and-using-moduleslibraries-3\/","title":{"rendered":"Importing and using modules\/libraries"},"content":{"rendered":"<p class=\"syndicated-attribution\"><em> --Originally published at <a href=\"https:\/\/sernap97.wordpress.com\/2016\/10\/28\/importing-and-using-moduleslibraries\/\"><a href=\"https:\/\/sernap97.wordpress.com\">Python<\/a><\/a><\/em><br \/><\/p>\n<p>Importing helps you use libraries or modules already available in Python 3. This means you don&#8217;t have to create functions from scratch, instead you can use the ones that already exist to save time and effort. There are a lot of libraries you can import, each has specific functions, in this blog, I will only focus in the import Math.<\/p>\n<p>Code:<\/p>\n<p>import math<\/p>\n<p>print(math.fabs(-8))<br \/>\nprint(math.ceil(1.1))<br \/>\nprint(math.factorial(4))<\/p>\n<p><img class=\"alignnone size-full wp-image-192\" src=\"https:\/\/sernap97.files.wordpress.com\/2016\/10\/2import.png?w=676\" alt=\"2import\" srcset=\"https:\/\/sernap97.files.wordpress.com\/2016\/10\/2import.png?w=676 676w, https:\/\/sernap97.files.wordpress.com\/2016\/10\/2import.png?w=150 150w, https:\/\/sernap97.files.wordpress.com\/2016\/10\/2import.png?w=300 300w, https:\/\/sernap97.files.wordpress.com\/2016\/10\/2import.png 732w\" sizes=\"(max-width: 676px) 100vw, 676px\"   \/><\/p>\n<p>As you can see, the first thing you need to do is import the module\/library, then you have to call it with a variable. For example, I used &#8220;math.fabs&#8221; which returns the absolute value of a number. So as a variable I used -8 and the program returned 8. There are 2 more examples below, but there are way more libraries you could use. If you want to learn more about them, check\u00a0<a href=\"https:\/\/docs.python.org\/3.2\/library\/math.html\" >this link<\/a>. It has all the functions you can use, as well as other modules\/libraries.<\/p><br \/>  <a rel=\"nofollow\" href=\"http:\/\/feeds.wordpress.com\/1.0\/gocomments\/sernap97.wordpress.com\/99\/\"><img alt=\"\" border=\"0\" src=\"http:\/\/feeds.wordpress.com\/1.0\/comments\/sernap97.wordpress.com\/99\/\" \/><\/a> <img alt=\"\" border=\"0\" src=\"https:\/\/pixel.wp.com\/b.gif?host=sernap97.wordpress.com&#038;blog=115348265&%23038;post=99&%23038;subd=sernap97&%23038;ref=&%23038;feed=1\" width=\"1\" height=\"1\" \/>","protected":false},"excerpt":{"rendered":"<p>&#8211;Originally published at Python Importing helps you use libraries or modules already available in Python 3. This means you don&#8217;t have to create functions from scratch, instead you can use the ones that already exist to save time and effort. There are a lot of libraries you can import, each has specific functions, in this &hellip; <a href=\"https:\/\/kenscourses.com\/tc101fall2016\/syndicated\/importing-and-using-moduleslibraries-3\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Importing and using modules\/libraries<\/span><\/a><\/p>\n","protected":false},"author":33,"featured_media":192,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,4],"tags":[89,348,185,186],"class_list":["post-38690","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blogs","category-syndicated","tag-python3","tag-import","tag-libraries","tag-modules"],"_links":{"self":[{"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/posts\/38690","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\/33"}],"replies":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/comments?post=38690"}],"version-history":[{"count":7,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/posts\/38690\/revisions"}],"predecessor-version":[{"id":42717,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/posts\/38690\/revisions\/42717"}],"wp:attachment":[{"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/media?parent=38690"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/categories?post=38690"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/tags?post=38690"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}