{"id":101,"date":"2019-01-31T23:55:22","date_gmt":"2019-01-31T23:55:22","guid":{"rendered":"https:\/\/kindsonthegenius.com\/python\/?p=101"},"modified":"2019-10-24T13:35:36","modified_gmt":"2019-10-24T13:35:36","slug":"08-python-basic-math-and-numbers","status":"publish","type":"post","link":"https:\/\/www.kindsonthegenius.com\/python\/08-python-basic-math-and-numbers\/","title":{"rendered":"Python &#8211; Basic Math &#038; Numbers"},"content":{"rendered":"\r\n<p>First of all, you need to know that Math and Numbers in Python is quite easy to follow. This is because, you only need to learn the functions you need to use. Therefore, we are going to examine Math and Numbers in Python.<\/p>\r\n\r\n\r\n\r\n<p>We would cover the following<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li><a href=\"#t1\">Introduction<\/a><\/li>\r\n<li><a href=\"#t2\">Python Number Types<\/a><\/li>\r\n<li><a href=\"#t3\">Numeric Type Conversion<\/a><\/li>\r\n<li><a href=\"#t4\">Math Functions in Python<\/a><\/li>\r\n<li><a href=\"#t5\">Random Number Functions<\/a><\/li>\r\n<li><a href=\"#t6\">Trig Functions in Python<\/a><\/li>\r\n<li><a href=\"#t7\">Watch the Video<\/a><\/li>\r\n<\/ul>\r\n<p>&nbsp;<\/p>\r\n\r\n\r\n\r\n<h4 class=\"wp-block-heading\"><strong id=\"t1\">1. Introduction<\/strong><\/h4>\r\n\r\n\r\n\r\n<p>For the reason that Python is an easy language to learn, the same goes for the Python Math as well. The first thing you need to remember is that you don&#8217;t need to declare a number variable before use.\u00a0<\/p>\r\n<p>You simply assign a number to a variable. Once you do this, a number object is created. Memory is allocated as well.<\/p>\r\n<p>For example:<\/p>\r\n<p>num1 = 34<\/p>\r\n<p>num2 = 2.5<\/p>\r\n<p>&nbsp;<\/p>\r\n<p><strong>The del keyword<\/strong><\/p>\r\n<p>This keyword is used to delete\u00a0 the reference to a number object. So you can say<\/p>\r\n<p>del num1<\/p>\r\n<p>del num2<\/p>\r\n<p>&nbsp;<\/p>\r\n\r\n\r\n\r\n<h4 class=\"wp-block-heading\"><strong id=\"t2\">2. Python Number Types<\/strong><\/h4>\r\n\r\n\r\n\r\n<p>Python provides number types that can be used to manipulate numbers. Although it has been discussed under Python Data Types, we would do a brief review of the four Python Number types.<\/p>\r\n<p><strong>int:<\/strong> This represents unsigned integers. They could be positive or negative. But the important thing to remember is that they contain no decimal point<\/p>\r\n<p>Examples of ints: 300, 123, 34, 56<\/p>\r\n<p>&nbsp;<\/p>\r\n<p><strong>long:<\/strong> They are also integers. However they have unlimited size. Unlike integers that are 32 bit. The create a long, you write the number followed by the letter L.<\/p>\r\n<p>Examples of long: 83948495L, 03335L, 0x3085L<\/p>\r\n<p>&nbsp;<\/p>\r\n<p><strong>float:<\/strong> These are numbers written with a decimal point.\u00a0 The decimal point separates the integer part and the decimal part.<\/p>\r\n<p>Examples of floats: 55.09, -45.,\u00a0 56.1e10, -45e20<\/p>\r\n<p>&nbsp;<\/p>\r\n<p><strong>complex:<\/strong> You may not use much of this though. It represents a number having two parts: a complex part and an imaginary part<\/p>\r\n\r\n\r\n\r\n<p>Examples of complex numbers: 1 + 2j, 3 +4j,\u00a0 10 + 12j<\/p>\r\n<p>&nbsp;<\/p>\r\n<p>&nbsp;<\/p>\r\n<h4><strong id=\"t3\">3. Numeric Type Conversion<\/strong><\/h4>\r\n<p>You can convert from one number type to another. To do that, you can use any of the following functions:<\/p>\r\n<p><strong>int (a):<\/strong> this function converts the number a to an int<\/p>\r\n<p><strong>long(a):<\/strong> you use this to convert the number a to a long<\/p>\r\n<p><strong>float(a):<\/strong> use this function to convert the number a to a float<\/p>\r\n<p><strong>complex (a):<\/strong> use this function to convert the number a, to a complex number<\/p>\r\n<p><strong>complex(a, b):<\/strong> this function creates a complex number using the parameters a and b<\/p>\r\n<p><strong>bin(a):<\/strong> converts a number to a binary representation<\/p>\r\n\r\n\r\n\r\n<p>&nbsp;<\/p>\r\n<h4><strong id=\"t4\">4. Mathematical Functions<\/strong><\/h4>\r\n<p>Python provides you with many of the useful functions needed to perform mathematical operations. They are listed in the table below:<\/p>\r\n<table class=\"table table-bordered\" align=\"center\">\r\n<tbody>\r\n<tr style=\"background-color: #f7f6f3;\">\r\n<th>SN.<\/th>\r\n<th>Function and brief description<\/th>\r\n<\/tr>\r\n<tr>\r\n<td class=\"ts\">1<\/td>\r\n<td><strong>abs(x)<\/strong>\r\n<p>The absolute value of x: that is the (positive) distance between zero and x.<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td class=\"ts\">2<\/td>\r\n<td><strong>ceil(x)<\/strong>\r\n<p>The ceiling of x: that is the smallest integer not less than x<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td class=\"ts\">3<\/td>\r\n<td><strong>cmp(x, y)<\/strong>\r\n<p>Returns -1 if x &lt; y, 0 if x == y, or 1 if x &gt; y<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td class=\"ts\">4<\/td>\r\n<td><strong>exp(x)<\/strong>\r\n<p>Returns the exponential of x: e<sup>x<\/sup><\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td class=\"ts\">5<\/td>\r\n<td><strong>fabs(x)<\/strong>\r\n<p>Returns the absolute value of x.<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td class=\"ts\">6<\/td>\r\n<td><strong>floor(x)<\/strong>\r\n<p>The floor of x: that is the largest integer not greater than x<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td class=\"ts\">7<\/td>\r\n<td><strong>log(x)<\/strong>\r\n<p>Returns the natural logarithm of x, for x&gt; 0<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td class=\"ts\">8<\/td>\r\n<td><strong>log10(x)<\/strong>\r\n<p>Returns the\u00a0 base-10 logarithm of x for x&gt; 0.<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td class=\"ts\">9<\/td>\r\n<td><strong>max(x1, x2,&#8230;)<\/strong>\r\n<p>Returns the largest of its arguments: the value closest to positive infinity<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td class=\"ts\">10<\/td>\r\n<td><strong>min(x1, x2,&#8230;)<\/strong>\r\n<p>Returns the smallest of its arguments: the value closest to negative infinity<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td class=\"ts\">11<\/td>\r\n<td><strong>modf(x)<\/strong>\r\n<p>Returns the fractional and integer parts of x in a two-item tuple. Both parts have the same sign as x. The integer part is returned as a float.<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td class=\"ts\">12<\/td>\r\n<td><strong>pow(x, y)<\/strong>\r\n<p>Returns the\u00a0 value of x**y. That is x raise to power y<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td class=\"ts\">13<\/td>\r\n<td><strong>round(x [,n])<\/strong>\r\n<p><b>x<\/b>\u00a0rounded to n decimal digits. Python rounds away from zero: so\u00a0 round(0.5) is 1.0 while round(-0.5) is -1.0.<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td class=\"ts\">14<\/td>\r\n<td><strong>sqrt(x)<\/strong>\r\n<p>Returns the square root of x for x &gt; 0<\/p>\r\n<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n\r\n<p>&nbsp;<\/p>\r\n<h4><strong id=\"t5\">5. Random Number Function<\/strong><\/h4>\r\n<p>These are other set of functions you need to know. They are used to either generate random numbers or select randomly from a list of numbers. It is applied in games, cryptography\/encryption, simulation, software testing and other applications.<\/p>\r\n<table class=\"table table-bordered\" align=\"center\">\r\n<tbody>\r\n<tr style=\"background-color: #f7f6f3;\">\r\n<th>SN<\/th>\r\n<th>Function and brief Description<\/th>\r\n<\/tr>\r\n<tr>\r\n<td class=\"ts\">1<\/td>\r\n<td><strong>choice(sequence)<\/strong>\r\n<p>A random item from a list, tuple, or string.<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td class=\"ts\">2<\/td>\r\n<td><strong>randrange ([start,] stop [,step])<\/strong>\r\n<p>Returns a randomly selected element from range(start, stop, step)<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td class=\"ts\">3<\/td>\r\n<td><strong>random()<\/strong>\r\n<p>A random float r, such that 0 is less than or equal to r and r is less than 1<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td class=\"ts\">4<\/td>\r\n<td><strong>seed([x])<\/strong>\r\n<p>Sets the integer start value used for generating random numbers. You call this function before calling any other random module function.\u00a0<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td class=\"ts\">5<\/td>\r\n<td><strong>shuffle(lst)<\/strong>\r\n<p>Randomizes the items of a list in place. Returns None.<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td class=\"ts\">6<\/td>\r\n<td><strong>uniform(x, y)<\/strong>\r\n<p>A random float s between x and y. such that x is less than or equal to s and s is less than y<\/p>\r\n<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<p>&nbsp;<\/p>\r\n<h4><strong id=\"t6\">6. Trig Functions<\/strong><\/h4>\r\n<p>This is another set of functions you may not be using too often. But it&#8217;s necessary you know them.<\/p>\r\n<table class=\"table table-bordered\" align=\"center\">\r\n<tbody>\r\n<tr style=\"background-color: #f7f6f3;\">\r\n<th>SN<\/th>\r\n<th>Function and brief description<\/th>\r\n<\/tr>\r\n<tr>\r\n<td class=\"ts\">1<\/td>\r\n<td><strong>acos(x)<\/strong>\r\n<p>Return the arc cosine of x, in radians.<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td class=\"ts\">2<\/td>\r\n<td><strong>asin(x)<\/strong>\r\n<p>Return the arc sine of x, in radians.<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td class=\"ts\">3<\/td>\r\n<td><strong>atan(x)<\/strong>\r\n<p>Return the arc tangent of x, in radians.<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td class=\"ts\">4<\/td>\r\n<td><strong>atan2(y, x)<\/strong>\r\n<p>Return atan(y \/ x), in radians.<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td class=\"ts\">5<\/td>\r\n<td><strong>cos(x)<\/strong>\r\n<p>Return the cosine of x radians.<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td class=\"ts\">6<\/td>\r\n<td><strong>hypot(x, y)<\/strong>\r\n<p>Return the Euclidean norm, sqrt(x*x + y*y).<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td class=\"ts\">7<\/td>\r\n<td><strong>sin(x)<\/strong>\r\n<p>Return the sine of x radians.<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td class=\"ts\">8<\/td>\r\n<td><strong>tan(x)<\/strong>\r\n<p>Return the tangent of x radians.<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td class=\"ts\">9<\/td>\r\n<td><strong>degrees(x)<\/strong>\r\n<p>Converts angle x from radians to degrees.<\/p>\r\n<\/td>\r\n<\/tr>\r\n<tr>\r\n<td class=\"ts\">10<\/td>\r\n<td><strong>radians(x)<\/strong>\r\n<p>Converts angle x from degrees to radians.<\/p>\r\n<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<p>&nbsp;<\/p>\r\n<h4><strong id=\"t7\">7. Watch the Video<\/strong><\/h4>\r\n<p><iframe loading=\"lazy\" src=\"https:\/\/www.youtube.com\/embed\/lu8gC4iInKs\" width=\"100%\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>","protected":false},"excerpt":{"rendered":"<p>First of all, you need to know that Math and Numbers in Python is quite easy to follow. This is because, you only need to &hellip; <\/p>\n","protected":false},"author":395,"featured_media":291,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[5],"tags":[8],"class_list":["post-101","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python-tutorials","tag-python-numbers"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Python - Basic Math &amp; Numbers - Python Tutorials<\/title>\n<meta name=\"description\" content=\"In this lesson, we reveiew numerical data types in Python and basic Mathematical operations. We also cover number type conversions\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.kindsonthegenius.com\/python\/08-python-basic-math-and-numbers\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python - Basic Math &amp; Numbers - Python Tutorials\" \/>\n<meta property=\"og:description\" content=\"In this lesson, we reveiew numerical data types in Python and basic Mathematical operations. We also cover number type conversions\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.kindsonthegenius.com\/python\/08-python-basic-math-and-numbers\/\" \/>\n<meta property=\"og:site_name\" content=\"Python Tutorials\" \/>\n<meta property=\"article:published_time\" content=\"2019-01-31T23:55:22+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-10-24T13:35:36+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.kindsonthegenius.com\/python\/wp-content\/uploads\/sites\/8\/2019\/01\/Basic-Math-and-Numbers-in-Python-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"905\" \/>\n\t<meta property=\"og:image:height\" content=\"494\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"kindsonthegenius\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"kindsonthegenius\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/08-python-basic-math-and-numbers\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/08-python-basic-math-and-numbers\\\/\"},\"author\":{\"name\":\"kindsonthegenius\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/#\\\/schema\\\/person\\\/63a68934672db675ff0cd80d066510c2\"},\"headline\":\"Python &#8211; Basic Math &#038; Numbers\",\"datePublished\":\"2019-01-31T23:55:22+00:00\",\"dateModified\":\"2019-10-24T13:35:36+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/08-python-basic-math-and-numbers\\\/\"},\"wordCount\":942,\"commentCount\":2,\"image\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/08-python-basic-math-and-numbers\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/wp-content\\\/uploads\\\/sites\\\/8\\\/2019\\\/01\\\/Basic-Math-and-Numbers-in-Python-1.jpg\",\"keywords\":[\"Python Numbers\"],\"articleSection\":[\"Python Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/08-python-basic-math-and-numbers\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/08-python-basic-math-and-numbers\\\/\",\"url\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/08-python-basic-math-and-numbers\\\/\",\"name\":\"Python - Basic Math & Numbers - Python Tutorials\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/08-python-basic-math-and-numbers\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/08-python-basic-math-and-numbers\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/wp-content\\\/uploads\\\/sites\\\/8\\\/2019\\\/01\\\/Basic-Math-and-Numbers-in-Python-1.jpg\",\"datePublished\":\"2019-01-31T23:55:22+00:00\",\"dateModified\":\"2019-10-24T13:35:36+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/#\\\/schema\\\/person\\\/63a68934672db675ff0cd80d066510c2\"},\"description\":\"In this lesson, we reveiew numerical data types in Python and basic Mathematical operations. We also cover number type conversions\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/08-python-basic-math-and-numbers\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/08-python-basic-math-and-numbers\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/08-python-basic-math-and-numbers\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/wp-content\\\/uploads\\\/sites\\\/8\\\/2019\\\/01\\\/Basic-Math-and-Numbers-in-Python-1.jpg\",\"contentUrl\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/wp-content\\\/uploads\\\/sites\\\/8\\\/2019\\\/01\\\/Basic-Math-and-Numbers-in-Python-1.jpg\",\"width\":905,\"height\":494,\"caption\":\"Basic Math and Numbers in Python\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/08-python-basic-math-and-numbers\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python &#8211; Basic Math &#038; Numbers\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/#website\",\"url\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/\",\"name\":\"Python Tutorials\",\"description\":\"Python Tutorial for Programming and Data Science\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/#\\\/schema\\\/person\\\/63a68934672db675ff0cd80d066510c2\",\"name\":\"kindsonthegenius\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3079a7f663b02e801d03cd075852a037af36bd179b5fbcd0603bae3dd7833a9b?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3079a7f663b02e801d03cd075852a037af36bd179b5fbcd0603bae3dd7833a9b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3079a7f663b02e801d03cd075852a037af36bd179b5fbcd0603bae3dd7833a9b?s=96&d=mm&r=g\",\"caption\":\"kindsonthegenius\"},\"url\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/python\\\/author\\\/kindsonthegenius-2\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python - Basic Math & Numbers - Python Tutorials","description":"In this lesson, we reveiew numerical data types in Python and basic Mathematical operations. We also cover number type conversions","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:\/\/www.kindsonthegenius.com\/python\/08-python-basic-math-and-numbers\/","og_locale":"en_US","og_type":"article","og_title":"Python - Basic Math & Numbers - Python Tutorials","og_description":"In this lesson, we reveiew numerical data types in Python and basic Mathematical operations. We also cover number type conversions","og_url":"https:\/\/www.kindsonthegenius.com\/python\/08-python-basic-math-and-numbers\/","og_site_name":"Python Tutorials","article_published_time":"2019-01-31T23:55:22+00:00","article_modified_time":"2019-10-24T13:35:36+00:00","og_image":[{"width":905,"height":494,"url":"https:\/\/www.kindsonthegenius.com\/python\/wp-content\/uploads\/sites\/8\/2019\/01\/Basic-Math-and-Numbers-in-Python-1.jpg","type":"image\/jpeg"}],"author":"kindsonthegenius","twitter_card":"summary_large_image","twitter_misc":{"Written by":"kindsonthegenius","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.kindsonthegenius.com\/python\/08-python-basic-math-and-numbers\/#article","isPartOf":{"@id":"https:\/\/www.kindsonthegenius.com\/python\/08-python-basic-math-and-numbers\/"},"author":{"name":"kindsonthegenius","@id":"https:\/\/www.kindsonthegenius.com\/python\/#\/schema\/person\/63a68934672db675ff0cd80d066510c2"},"headline":"Python &#8211; Basic Math &#038; Numbers","datePublished":"2019-01-31T23:55:22+00:00","dateModified":"2019-10-24T13:35:36+00:00","mainEntityOfPage":{"@id":"https:\/\/www.kindsonthegenius.com\/python\/08-python-basic-math-and-numbers\/"},"wordCount":942,"commentCount":2,"image":{"@id":"https:\/\/www.kindsonthegenius.com\/python\/08-python-basic-math-and-numbers\/#primaryimage"},"thumbnailUrl":"https:\/\/www.kindsonthegenius.com\/python\/wp-content\/uploads\/sites\/8\/2019\/01\/Basic-Math-and-Numbers-in-Python-1.jpg","keywords":["Python Numbers"],"articleSection":["Python Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.kindsonthegenius.com\/python\/08-python-basic-math-and-numbers\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.kindsonthegenius.com\/python\/08-python-basic-math-and-numbers\/","url":"https:\/\/www.kindsonthegenius.com\/python\/08-python-basic-math-and-numbers\/","name":"Python - Basic Math & Numbers - Python Tutorials","isPartOf":{"@id":"https:\/\/www.kindsonthegenius.com\/python\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.kindsonthegenius.com\/python\/08-python-basic-math-and-numbers\/#primaryimage"},"image":{"@id":"https:\/\/www.kindsonthegenius.com\/python\/08-python-basic-math-and-numbers\/#primaryimage"},"thumbnailUrl":"https:\/\/www.kindsonthegenius.com\/python\/wp-content\/uploads\/sites\/8\/2019\/01\/Basic-Math-and-Numbers-in-Python-1.jpg","datePublished":"2019-01-31T23:55:22+00:00","dateModified":"2019-10-24T13:35:36+00:00","author":{"@id":"https:\/\/www.kindsonthegenius.com\/python\/#\/schema\/person\/63a68934672db675ff0cd80d066510c2"},"description":"In this lesson, we reveiew numerical data types in Python and basic Mathematical operations. We also cover number type conversions","breadcrumb":{"@id":"https:\/\/www.kindsonthegenius.com\/python\/08-python-basic-math-and-numbers\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.kindsonthegenius.com\/python\/08-python-basic-math-and-numbers\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.kindsonthegenius.com\/python\/08-python-basic-math-and-numbers\/#primaryimage","url":"https:\/\/www.kindsonthegenius.com\/python\/wp-content\/uploads\/sites\/8\/2019\/01\/Basic-Math-and-Numbers-in-Python-1.jpg","contentUrl":"https:\/\/www.kindsonthegenius.com\/python\/wp-content\/uploads\/sites\/8\/2019\/01\/Basic-Math-and-Numbers-in-Python-1.jpg","width":905,"height":494,"caption":"Basic Math and Numbers in Python"},{"@type":"BreadcrumbList","@id":"https:\/\/www.kindsonthegenius.com\/python\/08-python-basic-math-and-numbers\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.kindsonthegenius.com\/python\/"},{"@type":"ListItem","position":2,"name":"Python &#8211; Basic Math &#038; Numbers"}]},{"@type":"WebSite","@id":"https:\/\/www.kindsonthegenius.com\/python\/#website","url":"https:\/\/www.kindsonthegenius.com\/python\/","name":"Python Tutorials","description":"Python Tutorial for Programming and Data Science","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.kindsonthegenius.com\/python\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.kindsonthegenius.com\/python\/#\/schema\/person\/63a68934672db675ff0cd80d066510c2","name":"kindsonthegenius","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/3079a7f663b02e801d03cd075852a037af36bd179b5fbcd0603bae3dd7833a9b?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/3079a7f663b02e801d03cd075852a037af36bd179b5fbcd0603bae3dd7833a9b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/3079a7f663b02e801d03cd075852a037af36bd179b5fbcd0603bae3dd7833a9b?s=96&d=mm&r=g","caption":"kindsonthegenius"},"url":"https:\/\/www.kindsonthegenius.com\/python\/author\/kindsonthegenius-2\/"}]}},"_links":{"self":[{"href":"https:\/\/www.kindsonthegenius.com\/python\/wp-json\/wp\/v2\/posts\/101","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kindsonthegenius.com\/python\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kindsonthegenius.com\/python\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kindsonthegenius.com\/python\/wp-json\/wp\/v2\/users\/395"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kindsonthegenius.com\/python\/wp-json\/wp\/v2\/comments?post=101"}],"version-history":[{"count":5,"href":"https:\/\/www.kindsonthegenius.com\/python\/wp-json\/wp\/v2\/posts\/101\/revisions"}],"predecessor-version":[{"id":341,"href":"https:\/\/www.kindsonthegenius.com\/python\/wp-json\/wp\/v2\/posts\/101\/revisions\/341"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.kindsonthegenius.com\/python\/wp-json\/wp\/v2\/media\/291"}],"wp:attachment":[{"href":"https:\/\/www.kindsonthegenius.com\/python\/wp-json\/wp\/v2\/media?parent=101"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kindsonthegenius.com\/python\/wp-json\/wp\/v2\/categories?post=101"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kindsonthegenius.com\/python\/wp-json\/wp\/v2\/tags?post=101"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}