{"id":71782,"date":"2022-07-18T09:36:50","date_gmt":"2022-07-18T09:36:50","guid":{"rendered":"https:\/\/itsourcecode.com\/?p=71782"},"modified":"2022-07-18T09:37:34","modified_gmt":"2022-07-18T09:37:34","slug":"abs-function-in-python","status":"publish","type":"post","link":"https:\/\/itsourcecode.com\/python-tutorial\/abs-function-in-python\/","title":{"rendered":"abs() Function in Python (Syntax, Parameters, and Examples)"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"h-what-is-abs-function-in-python\"><strong>What is abs() Function in Python?<\/strong><\/h2>\n\n\n\n<p>The <strong>abs() function<\/strong> in Python is used to get the absolute value of a number, which means it gets rid of the number&#8217;s negative sign. In&nbsp;this&nbsp;tutorial,&nbsp;we&#8217;ll&nbsp;talk&nbsp;about&nbsp;what&nbsp;the&nbsp;abs()&nbsp;function&nbsp;in&nbsp;Python&nbsp;is,&nbsp;how&nbsp;to&nbsp;use&nbsp;it,&nbsp;and&nbsp;some&nbsp;examples.<\/p>\n\n\n\n<p>The abs() function calculates the absolute value of its input argument. It returns either the positive or negative value of the input argument.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-abs-syntax\"><strong>abs() Syntax<\/strong><\/h2>\n\n\n\n<p>The syntax of the abs() function in Python is as follows:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><em>abs(n)<\/em><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-abs-parameters\"><strong>abs() Parameters<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th class=\"has-text-align-left\" data-align=\"left\">Parameter<\/th><th class=\"has-text-align-left\" data-align=\"left\">Description<\/th><\/tr><\/thead><tbody><tr><td class=\"has-text-align-left\" data-align=\"left\"><em>n<\/em><\/td><td class=\"has-text-align-left\" data-align=\"left\">Required a number.<\/td><\/tr><\/tbody><\/table><figcaption>abs() Parameters<\/figcaption><\/figure>\n\n\n\n<p>A number whose absolute value should be returned. It can be an <a href=\"https:\/\/itsourcecode.com\/python-tutorial\/python-numbers-type-conversion-and-data-types-with-examples\/#h-1-integer-data-type-in-python\">integer<\/a>, a <a href=\"https:\/\/itsourcecode.com\/python-tutorial\/python-numbers-type-conversion-and-data-types-with-examples\/#h-2-float-data-type-in-python\">float number<\/a>, or a <a href=\"https:\/\/itsourcecode.com\/python-tutorial\/python-numbers-type-conversion-and-data-types-with-examples\/#h-3-complex-numbers-in-python\">complex number<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-abs-return-value\"><strong>abs() Return Value<\/strong><\/h2>\n\n\n\n<p>The abs() function takes a number and gives back its absolute value.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>For integer numbers &#8211; an absolute number of integers is returned.<\/li><li>For floating numbers &#8211; the absolute value of the floating number is returned.<\/li><li>For complex numbers &#8211; the number&#8217;s size is returned.<\/li><\/ul>\n\n\n\n<p>If you want to test the Python code in this lesson, you will need to use a code editor like <a href=\"https:\/\/www.jetbrains.com\/pycharm\/download\/#section=windows\"><strong>PyCharm<\/strong><\/a>. But if you want to run this code online, we also have a free <strong><a href=\"https:\/\/itsourcecode.com\/python-compiler\/\">Online Compiler in Python<\/a><\/strong> that you can use to test your Python code.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-how-to-use-the-abs-function-in-python\"><strong>How to use the abs() function in Python?<\/strong><\/h2>\n\n\n\n<p>To use the abs() function in Python, you need only one argument, which is the only one it can take. An argument is always a number that can be either positive or negative.<\/p>\n\n\n\n<p>This number could be:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>A whole number, like 4, -15, or 10.<\/li><li>A number that can change, like 4.1, -15.06, or 2.13.<\/li><li>A tricky number. A complex number has two parts: a real part that is a real number, like 1 or 4, and an imaginary part that is not real.<br>In Python, the imaginary part is made by adding the letter j as a suffix, not the letter I as it is in Mathematics. You add j to the end of a real number, like 1j or 4j. So, 2 + 4j or 1 + 2j is an example of a complex number in Python.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-example-of-abs-function-in-python\"><strong>Example of abs() function in Python<\/strong><\/h2>\n\n\n\n<p>In this example, we give the abs() function<strong> float, int, and complex<\/strong> data, and it gives us back the absolute value.<\/p>\n\n\n\n<p><strong>Example 1<\/strong><\/p>\n\n\n\n<div data-pym-src=\"https:\/\/www.jdoodle.com\/embed\/v0\/4Z2p\/?stdin=0&amp;arg=0\"><\/div>\n<script src=\"https:\/\/www.jdoodle.com\/assets\/jdoodle-pym.min.js\" type=\"text\/javascript\"><\/script>\n\n\n\n<p><strong>Example 2<\/strong><\/p>\n\n\n\n<p>The equation below shows how speed, distance traveled, and time was taken are related. And since time, distance, and speed can never be negative, we&#8217;ll use the abs() method to figure out the exact time, distance, and speed.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Distance  = Speed * Time\nTime = Distance \/ Speed\nSpeed = Distance \/ Time<\/pre>\n\n\n\n<div data-pym-src=\"https:\/\/www.jdoodle.com\/embed\/v0\/4Z3F\/?stdin=0&amp;arg=0\"><\/div>\n<script src=\"https:\/\/www.jdoodle.com\/assets\/jdoodle-pym.min.js\" type=\"text\/javascript\"><\/script>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-conclusion\"><strong>Conclusion<\/strong><\/h2>\n\n\n\n<p>In this tutorial, we&#8217;ve discussed the <strong>abs() function in Python<\/strong> can be used to change a floating-point number or an integer into an absolute value. This is especially helpful when you want to find the difference between two values.<\/p>\n\n\n\n<p>By the way, if you want additional knowledge about built-in functions in Python you can check out our article about <a href=\"https:\/\/itsourcecode.com\/python-tutorial\/python-built-in-functions-with-examples\/\"><strong>Complete Python Built-in Functions with Syntax and Examples<\/strong><\/a>.<\/p>\n\n\n\n<p>Finally, I hope this lesson has helped you learn what is&nbsp;<strong>abs() function <\/strong>and its uses. Check out our list of&nbsp;<a href=\"https:\/\/itsourcecode.com\/topics\/python-tutorial\/\"><strong>Python Tutorial Topics<\/strong><\/a>&nbsp;if you missed any of our previous lessons.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>What is abs() Function in Python? The abs() function in Python is used to get the absolute value of a number, which means it gets rid of the number&#8217;s negative &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"abs() Function in Python (Syntax, Parameters, and Examples)\" class=\"read-more button\" href=\"https:\/\/itsourcecode.com\/python-tutorial\/abs-function-in-python\/#more-71782\" aria-label=\"Read more about abs() Function in Python (Syntax, Parameters, and Examples)\">Read more<\/a><\/p>\n","protected":false},"author":1373,"featured_media":71888,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[61036],"tags":[92561,92566,92567,92568,92563,92569,92564,92565,92562],"class_list":["post-71782","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python-tutorial","tag-abs-function-in-python","tag-abs-function-in-python-3","tag-abs-function-in-python-example","tag-abs-function-in-pythons","tag-example-of-abs-function-in-python","tag-function-of-abs-in-python","tag-how-to-use-abs-function-in-python","tag-what-is-abs-function-in-python","tag-what-is-the-abs-function-in-python","resize-featured-image"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.1 (Yoast SEO v27.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>abs() Function in Python (Syntax, Parameters, and Examples)<\/title>\n<meta name=\"description\" content=\"In this tutorial, we&#039;ll talk about what the abs() function in Python is, how to use it, and some examples of it in action.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/itsourcecode.com\/python-tutorial\/abs-function-in-python\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"abs() Function in Python (Syntax, Parameters, and Examples)\" \/>\n<meta property=\"og:description\" content=\"In this tutorial, we&#039;ll talk about what the abs() function in Python is, how to use it, and some examples of it in action.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/itsourcecode.com\/python-tutorial\/abs-function-in-python\/\" \/>\n<meta property=\"og:site_name\" content=\"Itsourcecode.com\" \/>\n<meta property=\"article:author\" content=\"www.facebook.com\/unguardable7\" \/>\n<meta property=\"article:published_time\" content=\"2022-07-18T09:36:50+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-07-18T09:37:34+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/itsourcecode.com\/wp-content\/uploads\/2022\/07\/abs-Function-in-Python.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1460\" \/>\n\t<meta property=\"og:image:height\" content=\"900\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Prince Ly Cesar\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@http:\/\/www.twitter.com\/unguardable0729\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Prince Ly Cesar\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/itsourcecode.com\\\/python-tutorial\\\/abs-function-in-python\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/itsourcecode.com\\\/python-tutorial\\\/abs-function-in-python\\\/\"},\"author\":{\"name\":\"Prince Ly Cesar\",\"@id\":\"https:\\\/\\\/itsourcecode.com\\\/#\\\/schema\\\/person\\\/8d6ff1c108160ddbd60ff17cbb9f626b\"},\"headline\":\"abs() Function in Python (Syntax, Parameters, and Examples)\",\"datePublished\":\"2022-07-18T09:36:50+00:00\",\"dateModified\":\"2022-07-18T09:37:34+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/itsourcecode.com\\\/python-tutorial\\\/abs-function-in-python\\\/\"},\"wordCount\":552,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/itsourcecode.com\\\/#\\\/schema\\\/person\\\/ad9e0497e03b85a9ca299d935298f5dc\"},\"image\":{\"@id\":\"https:\\\/\\\/itsourcecode.com\\\/python-tutorial\\\/abs-function-in-python\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/itsourcecode.com\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/abs-Function-in-Python.png\",\"keywords\":[\"abs function in python\",\"abs function in python 3\",\"abs function in python example\",\"abs function in pythons\",\"example of abs function in python\",\"function of abs in python\",\"how to use abs function in python\",\"what is abs function in python\",\"what is the abs function in python\"],\"articleSection\":[\"Python Tutorial\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/itsourcecode.com\\\/python-tutorial\\\/abs-function-in-python\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/itsourcecode.com\\\/python-tutorial\\\/abs-function-in-python\\\/\",\"url\":\"https:\\\/\\\/itsourcecode.com\\\/python-tutorial\\\/abs-function-in-python\\\/\",\"name\":\"abs() Function in Python (Syntax, Parameters, and Examples)\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/itsourcecode.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/itsourcecode.com\\\/python-tutorial\\\/abs-function-in-python\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/itsourcecode.com\\\/python-tutorial\\\/abs-function-in-python\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/itsourcecode.com\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/abs-Function-in-Python.png\",\"datePublished\":\"2022-07-18T09:36:50+00:00\",\"dateModified\":\"2022-07-18T09:37:34+00:00\",\"description\":\"In this tutorial, we'll talk about what the abs() function in Python is, how to use it, and some examples of it in action.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/itsourcecode.com\\\/python-tutorial\\\/abs-function-in-python\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/itsourcecode.com\\\/python-tutorial\\\/abs-function-in-python\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/itsourcecode.com\\\/python-tutorial\\\/abs-function-in-python\\\/#primaryimage\",\"url\":\"https:\\\/\\\/itsourcecode.com\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/abs-Function-in-Python.png\",\"contentUrl\":\"https:\\\/\\\/itsourcecode.com\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/abs-Function-in-Python.png\",\"width\":1460,\"height\":900,\"caption\":\"abs() Function in Python (Syntax, Parameters, and Examples)\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/itsourcecode.com\\\/python-tutorial\\\/abs-function-in-python\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/itsourcecode.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"abs() Function in Python (Syntax, Parameters, and Examples)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/itsourcecode.com\\\/#website\",\"url\":\"https:\\\/\\\/itsourcecode.com\\\/\",\"name\":\"Itsourcecode.com\",\"description\":\"Partner In Your Coding Journey!\",\"publisher\":{\"@id\":\"https:\\\/\\\/itsourcecode.com\\\/#\\\/schema\\\/person\\\/ad9e0497e03b85a9ca299d935298f5dc\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/itsourcecode.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/itsourcecode.com\\\/#\\\/schema\\\/person\\\/ad9e0497e03b85a9ca299d935298f5dc\",\"name\":\"itsourcecode\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/itsourcecode.com\\\/wp-content\\\/uploads\\\/2021\\\/01\\\/IT-SOURCECODE_ICON-07.jpg\",\"url\":\"https:\\\/\\\/itsourcecode.com\\\/wp-content\\\/uploads\\\/2021\\\/01\\\/IT-SOURCECODE_ICON-07.jpg\",\"contentUrl\":\"https:\\\/\\\/itsourcecode.com\\\/wp-content\\\/uploads\\\/2021\\\/01\\\/IT-SOURCECODE_ICON-07.jpg\",\"width\":409,\"height\":409,\"caption\":\"itsourcecode\"},\"logo\":{\"@id\":\"https:\\\/\\\/itsourcecode.com\\\/wp-content\\\/uploads\\\/2021\\\/01\\\/IT-SOURCECODE_ICON-07.jpg\"},\"description\":\"Hello Itsourcecoders, welcome to itsourcecode.com. I'm Joken Villanueva, MIT a passionate Blogger, Programmer and a Hobbyist. I started Itsourcecode because I wanted to give back and Share all the learnings and knowledge I've learned in my career and I believe through this website I would be able to help and assist those newbie programmers in enhancing their skills from different programming languages. So let us all help each other by sharing our ideas!\",\"sameAs\":[\"https:\\\/\\\/itsourcecode.com\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/itsourcecode.com\\\/#\\\/schema\\\/person\\\/8d6ff1c108160ddbd60ff17cbb9f626b\",\"name\":\"Prince Ly Cesar\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/itsourcecode.com\\\/wp-content\\\/litespeed\\\/avatar\\\/8fc9fa13530f18706fe0948f4673fae8.jpg?ver=1776478215\",\"url\":\"https:\\\/\\\/itsourcecode.com\\\/wp-content\\\/litespeed\\\/avatar\\\/8fc9fa13530f18706fe0948f4673fae8.jpg?ver=1776478215\",\"contentUrl\":\"https:\\\/\\\/itsourcecode.com\\\/wp-content\\\/litespeed\\\/avatar\\\/8fc9fa13530f18706fe0948f4673fae8.jpg?ver=1776478215\",\"caption\":\"Prince Ly Cesar\"},\"description\":\"Hi there! I'm Prince Ly Cesar a Student in Carlos Hilado Memorial State College - Binalbagan Campus and a Graphic Designer, Programmer &amp; Writer in IT SourceCode\",\"sameAs\":[\"https:\\\/\\\/activadorkeys.com\\\/\",\"www.facebook.com\\\/unguardable7\",\"http:\\\/\\\/www.instagram.com\\\/prnclycsr\\\/\",\"https:\\\/\\\/x.com\\\/http:\\\/\\\/www.twitter.com\\\/unguardable0729\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCF0BIqB5tpnCmwvYQCHucmw?view_as=subscriber\"],\"gender\":\"male\",\"knowsAbout\":[\"Graphic Designing\"],\"knowsLanguage\":[\"English\",\"Tagalog\"],\"jobTitle\":\"Graphic Designer\",\"worksFor\":\"IT SourceCode\",\"url\":\"https:\\\/\\\/itsourcecode.com\\\/author\\\/unguardable\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"abs() Function in Python (Syntax, Parameters, and Examples)","description":"In this tutorial, we'll talk about what the abs() function in Python is, how to use it, and some examples of it in action.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/itsourcecode.com\/python-tutorial\/abs-function-in-python\/","og_locale":"en_US","og_type":"article","og_title":"abs() Function in Python (Syntax, Parameters, and Examples)","og_description":"In this tutorial, we'll talk about what the abs() function in Python is, how to use it, and some examples of it in action.","og_url":"https:\/\/itsourcecode.com\/python-tutorial\/abs-function-in-python\/","og_site_name":"Itsourcecode.com","article_author":"www.facebook.com\/unguardable7","article_published_time":"2022-07-18T09:36:50+00:00","article_modified_time":"2022-07-18T09:37:34+00:00","og_image":[{"width":1460,"height":900,"url":"https:\/\/itsourcecode.com\/wp-content\/uploads\/2022\/07\/abs-Function-in-Python.png","type":"image\/png"}],"author":"Prince Ly Cesar","twitter_card":"summary_large_image","twitter_creator":"@http:\/\/www.twitter.com\/unguardable0729","twitter_misc":{"Written by":"Prince Ly Cesar","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/itsourcecode.com\/python-tutorial\/abs-function-in-python\/#article","isPartOf":{"@id":"https:\/\/itsourcecode.com\/python-tutorial\/abs-function-in-python\/"},"author":{"name":"Prince Ly Cesar","@id":"https:\/\/itsourcecode.com\/#\/schema\/person\/8d6ff1c108160ddbd60ff17cbb9f626b"},"headline":"abs() Function in Python (Syntax, Parameters, and Examples)","datePublished":"2022-07-18T09:36:50+00:00","dateModified":"2022-07-18T09:37:34+00:00","mainEntityOfPage":{"@id":"https:\/\/itsourcecode.com\/python-tutorial\/abs-function-in-python\/"},"wordCount":552,"commentCount":0,"publisher":{"@id":"https:\/\/itsourcecode.com\/#\/schema\/person\/ad9e0497e03b85a9ca299d935298f5dc"},"image":{"@id":"https:\/\/itsourcecode.com\/python-tutorial\/abs-function-in-python\/#primaryimage"},"thumbnailUrl":"https:\/\/itsourcecode.com\/wp-content\/uploads\/2022\/07\/abs-Function-in-Python.png","keywords":["abs function in python","abs function in python 3","abs function in python example","abs function in pythons","example of abs function in python","function of abs in python","how to use abs function in python","what is abs function in python","what is the abs function in python"],"articleSection":["Python Tutorial"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/itsourcecode.com\/python-tutorial\/abs-function-in-python\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/itsourcecode.com\/python-tutorial\/abs-function-in-python\/","url":"https:\/\/itsourcecode.com\/python-tutorial\/abs-function-in-python\/","name":"abs() Function in Python (Syntax, Parameters, and Examples)","isPartOf":{"@id":"https:\/\/itsourcecode.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/itsourcecode.com\/python-tutorial\/abs-function-in-python\/#primaryimage"},"image":{"@id":"https:\/\/itsourcecode.com\/python-tutorial\/abs-function-in-python\/#primaryimage"},"thumbnailUrl":"https:\/\/itsourcecode.com\/wp-content\/uploads\/2022\/07\/abs-Function-in-Python.png","datePublished":"2022-07-18T09:36:50+00:00","dateModified":"2022-07-18T09:37:34+00:00","description":"In this tutorial, we'll talk about what the abs() function in Python is, how to use it, and some examples of it in action.","breadcrumb":{"@id":"https:\/\/itsourcecode.com\/python-tutorial\/abs-function-in-python\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/itsourcecode.com\/python-tutorial\/abs-function-in-python\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/itsourcecode.com\/python-tutorial\/abs-function-in-python\/#primaryimage","url":"https:\/\/itsourcecode.com\/wp-content\/uploads\/2022\/07\/abs-Function-in-Python.png","contentUrl":"https:\/\/itsourcecode.com\/wp-content\/uploads\/2022\/07\/abs-Function-in-Python.png","width":1460,"height":900,"caption":"abs() Function in Python (Syntax, Parameters, and Examples)"},{"@type":"BreadcrumbList","@id":"https:\/\/itsourcecode.com\/python-tutorial\/abs-function-in-python\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/itsourcecode.com\/"},{"@type":"ListItem","position":2,"name":"abs() Function in Python (Syntax, Parameters, and Examples)"}]},{"@type":"WebSite","@id":"https:\/\/itsourcecode.com\/#website","url":"https:\/\/itsourcecode.com\/","name":"Itsourcecode.com","description":"Partner In Your Coding Journey!","publisher":{"@id":"https:\/\/itsourcecode.com\/#\/schema\/person\/ad9e0497e03b85a9ca299d935298f5dc"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/itsourcecode.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/itsourcecode.com\/#\/schema\/person\/ad9e0497e03b85a9ca299d935298f5dc","name":"itsourcecode","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/itsourcecode.com\/wp-content\/uploads\/2021\/01\/IT-SOURCECODE_ICON-07.jpg","url":"https:\/\/itsourcecode.com\/wp-content\/uploads\/2021\/01\/IT-SOURCECODE_ICON-07.jpg","contentUrl":"https:\/\/itsourcecode.com\/wp-content\/uploads\/2021\/01\/IT-SOURCECODE_ICON-07.jpg","width":409,"height":409,"caption":"itsourcecode"},"logo":{"@id":"https:\/\/itsourcecode.com\/wp-content\/uploads\/2021\/01\/IT-SOURCECODE_ICON-07.jpg"},"description":"Hello Itsourcecoders, welcome to itsourcecode.com. I'm Joken Villanueva, MIT a passionate Blogger, Programmer and a Hobbyist. I started Itsourcecode because I wanted to give back and Share all the learnings and knowledge I've learned in my career and I believe through this website I would be able to help and assist those newbie programmers in enhancing their skills from different programming languages. So let us all help each other by sharing our ideas!","sameAs":["https:\/\/itsourcecode.com\/"]},{"@type":"Person","@id":"https:\/\/itsourcecode.com\/#\/schema\/person\/8d6ff1c108160ddbd60ff17cbb9f626b","name":"Prince Ly Cesar","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/itsourcecode.com\/wp-content\/litespeed\/avatar\/8fc9fa13530f18706fe0948f4673fae8.jpg?ver=1776478215","url":"https:\/\/itsourcecode.com\/wp-content\/litespeed\/avatar\/8fc9fa13530f18706fe0948f4673fae8.jpg?ver=1776478215","contentUrl":"https:\/\/itsourcecode.com\/wp-content\/litespeed\/avatar\/8fc9fa13530f18706fe0948f4673fae8.jpg?ver=1776478215","caption":"Prince Ly Cesar"},"description":"Hi there! I'm Prince Ly Cesar a Student in Carlos Hilado Memorial State College - Binalbagan Campus and a Graphic Designer, Programmer &amp; Writer in IT SourceCode","sameAs":["https:\/\/activadorkeys.com\/","www.facebook.com\/unguardable7","http:\/\/www.instagram.com\/prnclycsr\/","https:\/\/x.com\/http:\/\/www.twitter.com\/unguardable0729","https:\/\/www.youtube.com\/channel\/UCF0BIqB5tpnCmwvYQCHucmw?view_as=subscriber"],"gender":"male","knowsAbout":["Graphic Designing"],"knowsLanguage":["English","Tagalog"],"jobTitle":"Graphic Designer","worksFor":"IT SourceCode","url":"https:\/\/itsourcecode.com\/author\/unguardable\/"}]}},"_links":{"self":[{"href":"https:\/\/itsourcecode.com\/wp-json\/wp\/v2\/posts\/71782","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itsourcecode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itsourcecode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itsourcecode.com\/wp-json\/wp\/v2\/users\/1373"}],"replies":[{"embeddable":true,"href":"https:\/\/itsourcecode.com\/wp-json\/wp\/v2\/comments?post=71782"}],"version-history":[{"count":16,"href":"https:\/\/itsourcecode.com\/wp-json\/wp\/v2\/posts\/71782\/revisions"}],"predecessor-version":[{"id":71983,"href":"https:\/\/itsourcecode.com\/wp-json\/wp\/v2\/posts\/71782\/revisions\/71983"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/itsourcecode.com\/wp-json\/wp\/v2\/media\/71888"}],"wp:attachment":[{"href":"https:\/\/itsourcecode.com\/wp-json\/wp\/v2\/media?parent=71782"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itsourcecode.com\/wp-json\/wp\/v2\/categories?post=71782"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itsourcecode.com\/wp-json\/wp\/v2\/tags?post=71782"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}