{"id":21599,"date":"2020-08-25T13:08:22","date_gmt":"2020-08-25T20:08:22","guid":{"rendered":"https:\/\/careerkarma.com\/blog\/?p=21599"},"modified":"2023-12-01T03:58:46","modified_gmt":"2023-12-01T11:58:46","slug":"python-typeerror-float-object-is-not-subscriptable","status":"publish","type":"post","link":"https:\/\/careerkarma.com\/blog\/python-typeerror-float-object-is-not-subscriptable\/","title":{"rendered":"Python typeerror: \u2018float\u2019 object is not subscriptable Solution"},"content":{"rendered":"\n<p>Values inside a float cannot be accessed using indexing syntax. This means that you cannot retrieve an individual number from a float. Otherwise, you\u2019ll encounter a \u201ctypeerror: \u2018float\u2019 object is not subscriptable\u201d in your program.<br><\/p>\n\n\n\n<p>In this guide, we talk about what this error means and why you may see it. We walk through two example scenarios so you can figure out how to fix this problem.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">typeerror: \u2018float\u2019 object is not subscriptable<\/h2>\n\n\n\n<p>You can retrieve individual items from an iterable object. For instance, you can get one item from a <a href=\"https:\/\/careerkarma.com\/blog\/python-array\/\">Python list<\/a>, or one item from a <a href=\"https:\/\/careerkarma.com\/blog\/python-dictionary-values\/\">dictionary<\/a>. This is because iterable objects contain a list of objects. These objects are accessed using indexing.<br><\/p>\n\n\n\n<p>You cannot retrieve a particular value from inside a float. <a href=\"https:\/\/careerkarma.com\/blog\/python-float\/\">Floating-point numbers<\/a>, like integers, are not iterable objects.<br><\/p>\n\n\n\n<p>The \u201ctypeerror: \u2018float\u2019 object is not subscriptable\u201d is commonly caused by:<br><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Trying to access a particular value from a floating-point number<\/li><li>Using the wrong syntax to replace multiple items in a list<\/li><\/ul>\n\n\n\n<p>Let\u2019s walk through each of these scenarios.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Scenario #1: Accessing an Item from a Float<\/h2>\n\n\n\n<p>We\u2019re building a program that checks if a ticket holder in a raffle is a winner. If a user\u2019s ticket number starts with 1 and ends in 7, they are a winner.<br><\/p>\n\n\n\n<p>Let\u2019s start by asking a user to insert a ticket number that should be checked:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>ticket_number = float(input(&quot;Enter a ticket number: &quot;))<\/pre><\/div>\n\n\n\n<p>We\u2019ve converted this value to a float because it is a number.<br><\/p>\n\n\n\n<p>Next, we use <a href=\"https:\/\/careerkarma.com\/blog\/python-dictionary-values\/\">indexing syntax<\/a> to retrieve the first and last numbers on a ticket:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>first = ticket_number[0]\nlast = ticket_number[-1]<\/pre><\/div>\n\n\n\n<p>The first item in our ticket number is at the index position 0; the last item is at the index position -1. Next, we use an <a href=\"https:\/\/careerkarma.com\/blog\/python-if-else\/\">\u201cif\u201d statement<\/a> to check if a user is a winner:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>if first == &quot;1&quot; and last == &quot;7&quot;:\n\tprint(&quot;You are a winner!&quot;)\nelse:\n\tprint(&quot;You are not a winner.&quot;)<\/pre><\/div>\n\n\n\n<p>If the value of \u201cfirst\u201d is equal to \u201c1\u201d and the value of \u201clast\u201d is equal to \u201c7\u201d, our \u201cif\u201d statement will run and inform a user they have won. Otherwise, our \u201celse\u201d statement will run, which will inform a user that they are not a winner.<br><\/p>\n\n\n\n<p>Let\u2019s run our code:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>Enter a ticket number: 23\nTraceback (most recent call last):\n  File &quot;main.py&quot;, line 3, in &lt;module&gt;\n\tfirst = ticket_number[0]\nTypeError: 'float' object is not subscriptable<\/pre><\/div>\n\n\n\n<p>Our code does not work. This is because ticket numbers are stored as a float. We cannot use indexing syntax to retrieve individual values from a float.<br><\/p>\n\n\n\n<p>To solve this error, we remove the <code>float()<\/code> conversion from our first line of code:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>ticket_number = input(&quot;Enter a ticket number: &quot;)<\/pre><\/div>\n\n\n\n<p>The <code>input()<\/code> method returns a string. We can manipulate a string using indexing, unlike a floating-point value. Let\u2019s run our code again:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>Enter a ticket number: 23\nYou are not a winner.<\/pre><\/div>\n\n\n\n<p>Our code appears to work successfully. Let\u2019s test our code on a winning ticket:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>Enter a ticket number: 117\nYou are a winner!<\/pre><\/div>\n\n\n\n<p>Our code works whether a ticket is a winner or not.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Scenario #2: Replacing Multiple Items<\/h2>\n\n\n\n<p>List slicing allows you to replace multiple items in a list. Slicing is where you specify a list of items in an iterable that you want to access or change.<br><\/p>\n\n\n\n<p>Let\u2019s build a program that resets the prices of all products in a list of donuts. We must build this program because a store is doing a \u201cDonut Day\u201d promotion where every donut is a particular price. We start by asking the user for the new price of donuts:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>price = input(&quot;Enter the price of the donuts: &quot;)<\/pre><\/div>\n\n\n\n<p>Next, we define a list of the current prices of donuts that we must change:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>donuts = [2.50, 2.75, 1.80, 1.75, 2.60]<\/pre><\/div>\n\n\n\n<p>Now that we have these values, we\u2019re ready to change our list. We can do this using indexing:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>donuts[0][1][2][3][4] = [float(price)] * 5\nprint(donuts)<\/pre><\/div>\n\n\n\n<p>This code resets the values in the \u201cdonuts\u201d list at the index positions 0, 1, 2, 3, and 4 to the value of \u201cprice\u201d. We\u2019ve converted the value of \u201cprice\u201d to a floating point number.<br><\/p>\n\n\n\n<p>We\u2019ve then enclosed the price in square brackets and <a href=\"https:\/\/careerkarma.com\/blog\/python-math-operators\/\">multiplied it by five<\/a>. This creates a list of values which we can assign to our \u201cdonuts\u201d list.<br><\/p>\n\n\n\n<p>Finally, we print the new list of prices to the console. Let\u2019s run our code:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>Enter the price of the donuts: 2.50\nTraceback (most recent call last):\n  File &quot;main.py&quot;, line 3, in &lt;module&gt;\n\tdonuts[0][1][2][3][4] = [float(price)] * 5\nTypeError: 'float' object is not subscriptable<\/pre><\/div>\n\n\n\n<p>When our code tries to change the values in the \u201cdonuts\u201d list, an error is returned. Our code tries to retrieve the item at the index position [0][1][2][3][4]. This does not exist in our list because our list only contains floats. To solve this error, use slicing syntax to update our list.&nbsp;<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>donuts[0:5] = [float(price)] * 5<\/pre><\/div>\n\n\n\n<p>This code retrieves all the items in our list from the range of 0 to 5 (exclusive of 5). Then, we assign each value the value of \u201cprice\u201d. Let\u2019s try our new code:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>Enter the price of the donuts: 2.50\n[2.5, 2.5, 2.5, 2.5, 2.5]<\/pre><\/div>\n\n\n\n<p>Our code successfully replaces all the items in our list.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>The \u201ctypeerror: \u2018float\u2019 object is not subscriptable\u201d error occurs when you try to access items from a floating point number as if the number is indexed.<br><\/p>\n\n\n\n<p>To solve this error, make sure you only use indexing or slicing syntax on a list of iterable objects. If you are trying to change multiple values in a list, make sure you use slicing to do so instead of specifying a list of index numbers whose values you want to change.<br><\/p>\n\n\n\n<p>Now you\u2019re ready to solve this error in your own code.<\/p>\n","protected":false},"excerpt":{"rendered":"Values inside a float cannot be accessed using indexing syntax. This means that you cannot retrieve an individual number from a float. Otherwise, you\u2019ll encounter a \u201ctypeerror: \u2018float\u2019 object is not subscriptable\u201d in your program. In this guide, we talk about what this error means and why you may see it. We walk through two&hellip;","protected":false},"author":240,"featured_media":21600,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[16578],"tags":[],"class_list":{"0":"post-21599","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.0 (Yoast SEO v27.0) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Python typeerror: \u2018float\u2019 object is not subscriptable | CK Guide<\/title>\n<meta name=\"description\" content=\"On Career Karma, learn about the Python typeerror: \u2018float\u2019 object is not subscriptable error, how the error works, and how to solve the error.\" \/>\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-typeerror-float-object-is-not-subscriptable\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python typeerror: \u2018float\u2019 object is not subscriptable Solution\" \/>\n<meta property=\"og:description\" content=\"On Career Karma, learn about the Python typeerror: \u2018float\u2019 object is not subscriptable error, how the error works, and how to solve the error.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/careerkarma.com\/blog\/python-typeerror-float-object-is-not-subscriptable\/\" \/>\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-08-25T20:08:22+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-01T11:58:46+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/08\/luke-chesser-1uxV8fAfhVM-unsplash.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1020\" \/>\n\t<meta property=\"og:image:height\" content=\"680\" \/>\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=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/careerkarma.com\/blog\/python-typeerror-float-object-is-not-subscriptable\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-typeerror-float-object-is-not-subscriptable\/\"},\"author\":{\"name\":\"James Gallagher\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\"},\"headline\":\"Python typeerror: \u2018float\u2019 object is not subscriptable Solution\",\"datePublished\":\"2020-08-25T20:08:22+00:00\",\"dateModified\":\"2023-12-01T11:58:46+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-typeerror-float-object-is-not-subscriptable\/\"},\"wordCount\":816,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-typeerror-float-object-is-not-subscriptable\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/08\/luke-chesser-1uxV8fAfhVM-unsplash.jpg\",\"articleSection\":[\"Python\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/careerkarma.com\/blog\/python-typeerror-float-object-is-not-subscriptable\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/careerkarma.com\/blog\/python-typeerror-float-object-is-not-subscriptable\/\",\"url\":\"https:\/\/careerkarma.com\/blog\/python-typeerror-float-object-is-not-subscriptable\/\",\"name\":\"Python typeerror: \u2018float\u2019 object is not subscriptable | CK Guide\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-typeerror-float-object-is-not-subscriptable\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-typeerror-float-object-is-not-subscriptable\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/08\/luke-chesser-1uxV8fAfhVM-unsplash.jpg\",\"datePublished\":\"2020-08-25T20:08:22+00:00\",\"dateModified\":\"2023-12-01T11:58:46+00:00\",\"author\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\"},\"description\":\"On Career Karma, learn about the Python typeerror: \u2018float\u2019 object is not subscriptable error, how the error works, and how to solve the error.\",\"breadcrumb\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-typeerror-float-object-is-not-subscriptable\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/careerkarma.com\/blog\/python-typeerror-float-object-is-not-subscriptable\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/careerkarma.com\/blog\/python-typeerror-float-object-is-not-subscriptable\/#primaryimage\",\"url\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/08\/luke-chesser-1uxV8fAfhVM-unsplash.jpg\",\"contentUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/08\/luke-chesser-1uxV8fAfhVM-unsplash.jpg\",\"width\":1020,\"height\":680},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/careerkarma.com\/blog\/python-typeerror-float-object-is-not-subscriptable\/#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 typeerror: \u2018float\u2019 object is not subscriptable Solution\"}]},{\"@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\/#\/schema\/person\/image\/\",\"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 typeerror: \u2018float\u2019 object is not subscriptable | CK Guide","description":"On Career Karma, learn about the Python typeerror: \u2018float\u2019 object is not subscriptable error, how the error works, and how to solve the error.","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-typeerror-float-object-is-not-subscriptable\/","og_locale":"en_US","og_type":"article","og_title":"Python typeerror: \u2018float\u2019 object is not subscriptable Solution","og_description":"On Career Karma, learn about the Python typeerror: \u2018float\u2019 object is not subscriptable error, how the error works, and how to solve the error.","og_url":"https:\/\/careerkarma.com\/blog\/python-typeerror-float-object-is-not-subscriptable\/","og_site_name":"Career Karma","article_publisher":"http:\/\/facebook.com\/careerkarmaapp","article_published_time":"2020-08-25T20:08:22+00:00","article_modified_time":"2023-12-01T11:58:46+00:00","og_image":[{"width":1020,"height":680,"url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/08\/luke-chesser-1uxV8fAfhVM-unsplash.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":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/careerkarma.com\/blog\/python-typeerror-float-object-is-not-subscriptable\/#article","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/python-typeerror-float-object-is-not-subscriptable\/"},"author":{"name":"James Gallagher","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"headline":"Python typeerror: \u2018float\u2019 object is not subscriptable Solution","datePublished":"2020-08-25T20:08:22+00:00","dateModified":"2023-12-01T11:58:46+00:00","mainEntityOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/python-typeerror-float-object-is-not-subscriptable\/"},"wordCount":816,"commentCount":0,"image":{"@id":"https:\/\/careerkarma.com\/blog\/python-typeerror-float-object-is-not-subscriptable\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/08\/luke-chesser-1uxV8fAfhVM-unsplash.jpg","articleSection":["Python"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/careerkarma.com\/blog\/python-typeerror-float-object-is-not-subscriptable\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/careerkarma.com\/blog\/python-typeerror-float-object-is-not-subscriptable\/","url":"https:\/\/careerkarma.com\/blog\/python-typeerror-float-object-is-not-subscriptable\/","name":"Python typeerror: \u2018float\u2019 object is not subscriptable | CK Guide","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/python-typeerror-float-object-is-not-subscriptable\/#primaryimage"},"image":{"@id":"https:\/\/careerkarma.com\/blog\/python-typeerror-float-object-is-not-subscriptable\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/08\/luke-chesser-1uxV8fAfhVM-unsplash.jpg","datePublished":"2020-08-25T20:08:22+00:00","dateModified":"2023-12-01T11:58:46+00:00","author":{"@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"description":"On Career Karma, learn about the Python typeerror: \u2018float\u2019 object is not subscriptable error, how the error works, and how to solve the error.","breadcrumb":{"@id":"https:\/\/careerkarma.com\/blog\/python-typeerror-float-object-is-not-subscriptable\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/careerkarma.com\/blog\/python-typeerror-float-object-is-not-subscriptable\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/python-typeerror-float-object-is-not-subscriptable\/#primaryimage","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/08\/luke-chesser-1uxV8fAfhVM-unsplash.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/08\/luke-chesser-1uxV8fAfhVM-unsplash.jpg","width":1020,"height":680},{"@type":"BreadcrumbList","@id":"https:\/\/careerkarma.com\/blog\/python-typeerror-float-object-is-not-subscriptable\/#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 typeerror: \u2018float\u2019 object is not subscriptable Solution"}]},{"@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\/#\/schema\/person\/image\/","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\/21599","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=21599"}],"version-history":[{"count":0,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/21599\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media\/21600"}],"wp:attachment":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media?parent=21599"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/categories?post=21599"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/tags?post=21599"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}