{"id":12780,"date":"2020-07-23T11:48:20","date_gmt":"2020-07-23T18:48:20","guid":{"rendered":"https:\/\/careerkarma.com\/blog\/?p=12780"},"modified":"2023-12-01T03:55:58","modified_gmt":"2023-12-01T11:55:58","slug":"python-float","status":"publish","type":"post","link":"https:\/\/careerkarma.com\/blog\/python-float\/","title":{"rendered":"Python Float: A Step-By-Step Guide"},"content":{"rendered":"\n<p><em>The Python <code>float()<\/code> method converts a number stored in a string or integer into a floating point number, or a number with a decimal point. Python floats are useful for any function that requires precision<\/em>, <em>like scientific notation.<\/em><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>Programming languages use various data types to store values. The type of data a value is stored as will affect how a program can manipulate that value. For instance, you cannot run a string function on an integer or a mathematical operation on a string.<\/p>\n\n\n\n<p>There are two number types in Python: <code>floating-point numbers (floats)<\/code> and <code>integers.<\/code> While floats can contain decimals, integers cannot.<\/p>\n\n\n\n<p>This tutorial will discuss the basics of floating-point numbers and how you can use the <code>float()<\/code> method to convert strings and integers to floats in Python. We\u2019ll also walk through programming examples that employ the <code>float()<\/code> method to convert integers and strings to floating-point numbers.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Python Float<\/h2>\n\n\n\n<p>Any numerical value entered into Python will be seen as a number, so it\u2019s not necessary to declare that a value is a number. When you insert a value without decimals, Python will interpret it as an integer (e.g., 24 or -72); values that include decimals will be interpreted as floats (e.g., 102.2 or -4.91).<\/p>\n\n\n\n<p>Integers include positive whole numbers (e.g., 3, 7, 26), their negative counterparts (e.g., -3, -7, -26), and 0. In Python, integers are commonly referred to using the term <code>int<\/code>. Here\u2019s an example of a program that prints out an integer to the console:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>print(4)<\/pre><\/div>\n\n\n\n<p>Our code returns: <code>4<\/code>.<\/p>\n\n\n\n<p>Floating-point numbers, on the other hand, are real numbers. Unlike integers, floating-point numbers can store decimal values.<\/p>\n\n\n\n<p>Here\u2019s a program that prints out a floating-point number to the console:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>print(3.14)<\/pre><\/div>\n\n\n\n<p>Our code returns: <code>3.14<\/code>.<\/p>\n\n\n\n<p>Because both integers and floats are numbers (in terms of their data type), we can perform mathematical operations on them. So, if we wanted to perform floating-point arithmetic and add two floats together, for example, we could do so using the following code:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>math_sum = 22.5 + 17.4\nprint(math_sum)<\/pre><\/div>\n\n\n\n<p>Our code computes 22.5 + 17.4, and then returns: <code>39.9<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Python float() Method<\/h2>\n\n\n\n<p>The <code>float()<\/code> method is a built-in Python function that is used to convert an integer or a string to a floating-point value.<\/p>\n\n\n\n<p>Here\u2019s the syntax for the <code>float()<\/code> method in Python:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>float(value)<\/pre><\/div>\n\n\n\n<p>The <code>float()<\/code> method takes in one parameter: the value you want to convert to a float. This parameter is optional and its default value is 0.0.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Converting an Integer to a Float in Python<\/h2>\n\n\n\n<p>You can use the <code>float()<\/code> method in Python to convert an integer to a floating-point number. Here\u2019s an example:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>float_number = float(12)\n\nprint(float_number)<\/pre><\/div>\n\n\n\n<p>Our code returns: <code>12.0<\/code>.<\/p>\n\n\n\n<p>Here, we used the <code>float()<\/code> method to convert an integer <code>(12)<\/code> into a floating-point number <code>(12.0)<\/code>. The <code>.0<\/code> at the end tells us that our number has successfully been converted to a floating-point value.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Converting a String to a Float in Python<\/h2>\n\n\n\n<p>In Python, a string is a sequence of characters.&nbsp; Just as <code>float()<\/code> can convert an integer to a floating-point number, it can convert a string to a floating-point number as well. To do so, the string must be numerical.<\/p>\n\n\n\n<p>Here\u2019s an example of <code>float()<\/code> being used to convert a string to a floating-point number in Python:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>float_string = float(&quot;12&quot;)\n\nprint(float_string)<\/pre><\/div>\n\n\n\n<p>Our code returns: <code>12.0<\/code>.<\/p>\n\n\n\n<p>In this example, a numerical value <code>(12)<\/code> was stored as a string in our program. The <code>float()<\/code> method converted this value into a floating-point number.<\/p>\n\n\n\n<p>You can use the <code>+<\/code> and <code>-<\/code> signs to denote whether you want your string to be converted to a positive float or a negative float. Here\u2019s an example of this in action:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>float_string = float(&quot;-12&quot;)\n\nprint(float_string)<\/pre><\/div>\n\n\n\n<p>Our code returns: <code>-12.0<\/code>. Notice that our data is now stored as a float, rather than a string. This is evident because our number is not in quotation marks, and ends with <code>.0<\/code>.&nbsp;<\/p>\n\n\n\n<p>Strings can also contain <code>NaN<\/code>, <code>infinity<\/code>, or <code>inf<\/code>. These combinations of letters are used to represent invalid numbers (<code>NaN<\/code>) and infinity values (<code>infinity<\/code> or <code>inf<\/code>).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Python Float(): Example<\/h2>\n\n\n\n<p>Let\u2019s walk through a more detailed example to show how to use the <code>float()<\/code> method in Python.<\/p>\n\n\n\n<p>Say that we are creating a math game for fourth-grade students who are learning about adding and subtracting decimal numbers. This game will give students a math problem to solve and will evaluate whether their responses are accurate. Because we are working with decimals, we\u2019ll want our code to convert each number to a float.<\/p>\n\n\n\n<p>Here\u2019s the code we could use to create this game:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>answer = round(12.2 + 14.6, 1)\n\nstudent_input = input(&quot;What is 12.2 + 14.6?&quot;)\n\nif float(student_input) == answer:\n\tprint(&quot;You're right!&quot;)\nelse:\n\tprint(&quot;The correct answer to 12.2 + 14.6 is&quot;, answer, &quot;.&quot;)<\/pre><\/div>\n\n\n\n<p>When we run our code and input the correct answer <code>(26.8)<\/code> in response to the prompt, our code returns the following: <\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>What is 12.2 + 14.6?\n26.8\nYou're right!<\/pre><\/div>\n\n\n\n<p>When we run our code and input the incorrect answer (for example, -2.4) in response to the prompt, our code returns the following: <\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>What is 12.2 + 14.6?\n-2.4\nThe correct answer to 12.2 + 14.6 is 26.8.<\/pre><\/div>\n\n\n\n<p>Let\u2019s break down our code. On the first line, we calculate the answer to a math problem (12.2 + 14.6) and use the <code>round()<\/code> method to make sure we have a value that is rounded to one decimal place.<\/p>\n\n\n\n<p>Then, we use the <code>input()<\/code> method to ask a student to input an answer to the math problem. The parameter of the input method here is the question our program will ask students (<code>What is 12.2 + 14.6?<\/code>)<\/p>\n\n\n\n<p>On the next line, we use an <code>if<\/code> statement to compare whether the student\u2019s answer is equal to the answer our program calculated. Importantly, we use the <code>float()<\/code> method to convert the variable <code>student_input<\/code> to a float. We must do this because the <code>input()<\/code> method returns data in a string format, and we cannot compare a string to a float. So, in order for our program to work, we needed to convert <code>student_input<\/code> to a float.<\/p>\n\n\n\n<p>If a student enters the correct answer, the message <code>You\u2019re right!<\/code> is printed to the console; otherwise, the console prints the correct answer, which follows the text we set to precede the answer (<code>The correct answer to 12.2 + 14.6 is<\/code>).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>Floating-point numbers are a crucial part of programming. They allow developers to work with decimal values. This tutorial discussed the basics of floating-point values in Python and walked through a few examples of how to use the <code>float()<\/code> method to convert integers and strings to floating-point numbers.&nbsp;<\/p>\n\n\n\n<p>You\u2019re now ready to start working with floating-point numbers and the built-in Python <code>float()<\/code> method like an expert!<\/p>\n","protected":false},"excerpt":{"rendered":"The Python float() method converts a number stored in a string or integer into a floating point number, or a number with a decimal point. Python floats are useful for any function that requires precision, like scientific notation. Programming languages use various data types to store values. The type of data a value is stored&hellip;","protected":false},"author":240,"featured_media":12841,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[16578],"tags":[],"class_list":{"0":"post-12780","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-python"},"acf":{"post_sub_title":"","sprint_id":"","query_class":"Python","school_sft":"","parent_sft":"","school_privacy_policy":"","has_review":null,"is_sponser_post":"","is_guest_post":""},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.4 (Yoast SEO v27.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Python Float: A Step-By-Step Guide | Career Karma<\/title>\n<meta name=\"description\" content=\"Floating-point numbers are a data type in Python. On Career Karma, learn about floating-point numbers and how to use the float() method.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/careerkarma.com\/blog\/python-float\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python Float: A Step-By-Step Guide\" \/>\n<meta property=\"og:description\" content=\"Floating-point numbers are a data type in Python. On Career Karma, learn about floating-point numbers and how to use the float() method.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/careerkarma.com\/blog\/python-float\/\" \/>\n<meta property=\"og:site_name\" content=\"Career Karma\" \/>\n<meta property=\"article:publisher\" content=\"http:\/\/facebook.com\/careerkarmaapp\" \/>\n<meta property=\"article:published_time\" content=\"2020-07-23T18:48:20+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-01T11:55:58+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/apple-magic-keyboard-with-numeric-pad-on-table-near-wireless-1714205-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"800\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"James Gallagher\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@career_karma\" \/>\n<meta name=\"twitter:site\" content=\"@career_karma\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"James Gallagher\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/python-float\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/python-float\\\/\"},\"author\":{\"name\":\"James Gallagher\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/e79364792443fbff794a144c67ec8e94\"},\"headline\":\"Python Float: A Step-By-Step Guide\",\"datePublished\":\"2020-07-23T18:48:20+00:00\",\"dateModified\":\"2023-12-01T11:55:58+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/python-float\\\/\"},\"wordCount\":987,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/python-float\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/03\\\/apple-magic-keyboard-with-numeric-pad-on-table-near-wireless-1714205-1.jpg\",\"articleSection\":[\"Python\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/careerkarma.com\\\/blog\\\/python-float\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/python-float\\\/\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/python-float\\\/\",\"name\":\"Python Float: A Step-By-Step Guide | Career Karma\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/python-float\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/python-float\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/03\\\/apple-magic-keyboard-with-numeric-pad-on-table-near-wireless-1714205-1.jpg\",\"datePublished\":\"2020-07-23T18:48:20+00:00\",\"dateModified\":\"2023-12-01T11:55:58+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/e79364792443fbff794a144c67ec8e94\"},\"description\":\"Floating-point numbers are a data type in Python. On Career Karma, learn about floating-point numbers and how to use the float() method.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/python-float\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/careerkarma.com\\\/blog\\\/python-float\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/python-float\\\/#primaryimage\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/03\\\/apple-magic-keyboard-with-numeric-pad-on-table-near-wireless-1714205-1.jpg\",\"contentUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/03\\\/apple-magic-keyboard-with-numeric-pad-on-table-near-wireless-1714205-1.jpg\",\"width\":1200,\"height\":800},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/python-float\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Blog\",\"item\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python\",\"item\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/python\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Python Float: A Step-By-Step Guide\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/\",\"name\":\"Career Karma\",\"description\":\"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/e79364792443fbff794a144c67ec8e94\",\"name\":\"James Gallagher\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/james-gallagher-150x150.jpg\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/james-gallagher-150x150.jpg\",\"contentUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/james-gallagher-150x150.jpg\",\"caption\":\"James Gallagher\"},\"description\":\"James Gallagher is a self-taught programmer and the technical content manager at Career Karma. He has experience in range of programming languages and extensive expertise in Python, HTML, CSS, and JavaScript. James has written hundreds of programming tutorials, and he frequently contributes to publications like Codecademy, Treehouse, Repl.it, Afrotech, and others.\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/author\\\/jamesgallagher\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Python Float: A Step-By-Step Guide | Career Karma","description":"Floating-point numbers are a data type in Python. On Career Karma, learn about floating-point numbers and how to use the float() method.","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:\/\/careerkarma.com\/blog\/python-float\/","og_locale":"en_US","og_type":"article","og_title":"Python Float: A Step-By-Step Guide","og_description":"Floating-point numbers are a data type in Python. On Career Karma, learn about floating-point numbers and how to use the float() method.","og_url":"https:\/\/careerkarma.com\/blog\/python-float\/","og_site_name":"Career Karma","article_publisher":"http:\/\/facebook.com\/careerkarmaapp","article_published_time":"2020-07-23T18:48:20+00:00","article_modified_time":"2023-12-01T11:55:58+00:00","og_image":[{"width":1200,"height":800,"url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/apple-magic-keyboard-with-numeric-pad-on-table-near-wireless-1714205-1.jpg","type":"image\/jpeg"}],"author":"James Gallagher","twitter_card":"summary_large_image","twitter_creator":"@career_karma","twitter_site":"@career_karma","twitter_misc":{"Written by":"James Gallagher","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/careerkarma.com\/blog\/python-float\/#article","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/python-float\/"},"author":{"name":"James Gallagher","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"headline":"Python Float: A Step-By-Step Guide","datePublished":"2020-07-23T18:48:20+00:00","dateModified":"2023-12-01T11:55:58+00:00","mainEntityOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/python-float\/"},"wordCount":987,"commentCount":0,"image":{"@id":"https:\/\/careerkarma.com\/blog\/python-float\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/apple-magic-keyboard-with-numeric-pad-on-table-near-wireless-1714205-1.jpg","articleSection":["Python"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/careerkarma.com\/blog\/python-float\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/careerkarma.com\/blog\/python-float\/","url":"https:\/\/careerkarma.com\/blog\/python-float\/","name":"Python Float: A Step-By-Step Guide | Career Karma","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/python-float\/#primaryimage"},"image":{"@id":"https:\/\/careerkarma.com\/blog\/python-float\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/apple-magic-keyboard-with-numeric-pad-on-table-near-wireless-1714205-1.jpg","datePublished":"2020-07-23T18:48:20+00:00","dateModified":"2023-12-01T11:55:58+00:00","author":{"@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"description":"Floating-point numbers are a data type in Python. On Career Karma, learn about floating-point numbers and how to use the float() method.","breadcrumb":{"@id":"https:\/\/careerkarma.com\/blog\/python-float\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/careerkarma.com\/blog\/python-float\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/python-float\/#primaryimage","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/apple-magic-keyboard-with-numeric-pad-on-table-near-wireless-1714205-1.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/apple-magic-keyboard-with-numeric-pad-on-table-near-wireless-1714205-1.jpg","width":1200,"height":800},{"@type":"BreadcrumbList","@id":"https:\/\/careerkarma.com\/blog\/python-float\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog","item":"https:\/\/careerkarma.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Python","item":"https:\/\/careerkarma.com\/blog\/python\/"},{"@type":"ListItem","position":3,"name":"Python Float: A Step-By-Step Guide"}]},{"@type":"WebSite","@id":"https:\/\/careerkarma.com\/blog\/#website","url":"https:\/\/careerkarma.com\/blog\/","name":"Career Karma","description":"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/careerkarma.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94","name":"James Gallagher","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","caption":"James Gallagher"},"description":"James Gallagher is a self-taught programmer and the technical content manager at Career Karma. He has experience in range of programming languages and extensive expertise in Python, HTML, CSS, and JavaScript. James has written hundreds of programming tutorials, and he frequently contributes to publications like Codecademy, Treehouse, Repl.it, Afrotech, and others.","url":"https:\/\/careerkarma.com\/blog\/author\/jamesgallagher\/"}]}},"_links":{"self":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/12780","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/users\/240"}],"replies":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/comments?post=12780"}],"version-history":[{"count":0,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/12780\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media\/12841"}],"wp:attachment":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media?parent=12780"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/categories?post=12780"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/tags?post=12780"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}