{"id":13201,"date":"2020-07-23T14:41:59","date_gmt":"2020-07-23T21:41:59","guid":{"rendered":"https:\/\/careerkarma.com\/blog\/?p=13201"},"modified":"2023-12-01T03:55:59","modified_gmt":"2023-12-01T11:55:59","slug":"python-assert","status":"publish","type":"post","link":"https:\/\/careerkarma.com\/blog\/python-assert\/","title":{"rendered":"Python Assert Statements: A Step-By-Step Guide"},"content":{"rendered":"\n<p><em>The Python assert keyword tests if a condition is true. If a condition is false, the program will stop with an optional message. Assert statements are used to debug code and handle errors. You should not use an assert statement in a production environment.<\/em><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>Debugging is a crucial part of programming in any language. When debugging programs in Python, there may be times when you want to test for a certain condition. If that condition is not met, the program should return an error. That way, you know what to fix in your code.<\/p>\n\n\n\n<p>That\u2019s where the Python assert keyword comes in. The assert statement lets you test for a particular condition in Python. It is used commonly during <a href=\"https:\/\/careerkarma.com\/blog\/debug-in-python\/\">Python debugging<\/a> to handle errors.<\/p>\n\n\n\n<p>This Python tutorial will explore the importance of assertion and how to use the assert statement. We&#8217;ll walk through a few examples of using the assert expression in a program to help you get started.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Assertion in Python<\/h2>\n\n\n\n<p>The assert statement tests for conditions in Python and fix bugs more quickly. If the condition you are testing with the assert statement evaluates to <em>True<\/em>, the program will continue to execute. If the assertion evaluates to False, the program will raise an AssertionError (+\/- an optional message).<\/p>\n\n\n\n<p>Assertions are used to identify and remove certain conditions when code is run. For instance, say you are running an operation on a list that will change the list\u2019s values. You may want to use an assertion to ensure certain conditions are met before the list is changed. This will prevent making changes to your list that may not be correct.<\/p>\n\n\n\n<p>Assertions are not a replacement for program errors such a <a href=\"https:\/\/careerkarma.com\/blog\/python-syntaxerror-invalid-syntax\/\">SyntaxError<\/a> or a <a href=\"https:\/\/careerkarma.com\/blog\/python-nameerror-name-is-not-defined\/\">NameError<\/a>. If you\u2019re looking to test a block of code, using \u201c<a href=\"https:\/\/careerkarma.com\/blog\/python-try-except\">try \u2026 except<\/a>\u201d would be more appropriate. But if you want to check for a certain condition in your code, an assert statement may be more useful.<\/p>\n\n\n\n<p>You should use assertions sparingly and only during debugging. This is important for two reasons.&nbsp;<\/p>\n\n\n\n<p>First, assertions help developers find the cause of a bug before it impacts other code. Assertions do not raise just any error in a program. A developer must define an assertion in their code.<\/p>\n\n\n\n<p>Second, <a href=\"https:\/\/careerkarma.com\/blog\/python-interpreter\/\"><strong>Python interpreter<\/strong><\/a><strong> users can disable assertion statements<\/strong>. Therefore, a number of problems can arise if you rely on assertions too heavily for error handling and a user disables assertions.<\/p>\n\n\n\n<p>You should never use assertions to validate data outside a development environment. This is because disabling assertions could have a significant impact on how your program runs. If you rely on assertions, and they are disabled, your program could return new errors that you do not expect.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Python Assert Statements<\/h2>\n\n\n\n<p>An assert statement checks whether a condition is true. If a condition evaluates to <em>True<\/em>, a program will keep running. If a condition is false, the program will return an AssertionError. At this point, the program will stop executing.<\/p>\n\n\n\n<p>In Python, <em>assert<\/em> is a keyword. This means that you will see the assert keyword appear in a special color when you use it. It uses the following syntax:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>assert condition, message<\/pre><\/div>\n\n\n\n<p>Here are the two parameters assert can take in:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>condition<\/strong>: the condition for which you want to test (required)<\/li><li><strong>message<\/strong>: the message you want to display upon execution of the assert statement (optional)<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Assert Python Example<\/h2>\n\n\n\n<p>Let\u2019s use an example to illustrate the assert keyword in action. Say that we are creating a program that calculates whether a student passed or failed a certain test. A grade of 52 or higher is a pass, while any grade lower than 52 is a fail.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Checking for an Error<\/h3>\n\n\n\n<p>We want to make sure that we have inserted a user\u2019s data into the program before we perform any calculations. Otherwise, our program may say that a user failed the test even though the data is not present.<\/p>\n\n\n\n<p>We could create check for an error using the following code:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>student_grades = [57, 74, 49, 0, 87, 66, 89]\n\nfor g in student_grades:\n\tassert student_grades[g] != 0\n\tif student_grades[g] &gt;= 52:\n\t\tprint('This student passed.')\n\telse:\n\t\tprint('This student failed.')\n\nprint('Program complete')<\/pre><\/div>\n\n\n\n<p>When we run our code, the program returns the following output: <\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>This student passed.\nThis student passed.\nThis student failed.\n...\nassert student_grades[g] != 0\nAssertionError<\/pre><\/div>\n\n\n\n<p>On the first line of our code, we declare a list of student grades.<\/p>\n\n\n\n<p>We create a <a href=\"https:\/\/careerkarma.com\/blog\/python-for-loop\/\"><em>for<\/em><\/a><a href=\"https:\/\/careerkarma.com\/blog\/python-for-loop\/\"> loop<\/a> that iterates through the list of student grades. This for loop contains an assert statement that will raise an error if the statement <em>student_grades[g] != 0<\/em> evaluates to <em>False<\/em>. In other words, if a student\u2019s grade is 0, the program will return an AssertionError.<\/p>\n\n\n\n<p>We define an <em>if<\/em> statement. This statement prints a message to the console if a student scored 52 or higher on the test (<em>This student passed.<\/em>). We display a different message if a student scored less than 52 (<em>This student failed.<\/em>). Finally, our program prints out <em>Program complete<\/em> to the console.<\/p>\n\n\n\n<p>As you can see, our program started going through the list of student grades and calculating whether they passed or failed the test. However, when our program reached the fourth value in our list, it raised an AssertionError. This is because our student grade was equal to 0.<\/p>\n\n\n\n<p>We wanted to make sure that each student\u2019s numerical grade was present before calculating their grade. If a student&#8217;s grade was not present, we should use 0 in place of their numerical grade.<\/p>\n\n\n\n<p>This would allow us to make sure that we do not give a student an incorrect grade. This is likely because this program is still in testing. We are still making changes to our program.<\/p>\n\n\n\n<p>If this were a final program, we would want to use a more robust error-handling method than assert. But, for the purposes of debugging, assert is acceptable.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Adding a Custom Error Message<\/h3>\n\n\n\n<p>Now, let\u2019s say that we want to include a custom error message in our program. If a user\u2019s grade is equal to 52, we want an error to be raised. This error should say <em>Student grade is 0<\/em>. This error will make it clear to us, the developers, what problem our program encountered.<\/p>\n\n\n\n<p>Here\u2019s the code we would use to add an error message to our above code:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>...\n\tassert student_grades[g] != 0, &quot;Student grade is 0.&quot;\n\tif student_grades[g] &gt;= 52:\n\t\tprint('This student passed.')\n\telse:\n\t\tprint('This student failed.')\n\u2026<\/pre><\/div>\n\n\n\n<p>Now, when we run our program, we get the following result: <\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>This student passed.\nThis student passed.\nThis student failed.\n\u2026\nAssertionError: Student grade is 0.<\/pre><\/div>\n\n\n\n<p>The program still raised an AssertionError. This time our displayed an additional error message that we defined in our code. The additional message can help the developer better understand the problems in their program, which can make debugging more efficient.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>Python assertions are a useful debugging tool that can help you write more maintainable code. They make it easier to test for certain conditions in your code. <\/p>\n\n\n\n<p>We suggest you use Python assertions sparingly. Since users can disable assertions, we suggest you never use them to perform tasks such as data validation. If you rely on assertions and they are disabled, your program may not run correctly.<\/p>\n\n\n\n<p>This guide explored the usefulness and limitations of the Python assert keyword and how to use it. In addition, we discussed an example of the assert keyword in use. We also covered how to define custom error messages using assert.<\/p>\n\n\n\n<p>Knowing how to use the assert statement is a good skill to have. Learning it is another step on your journey toward becoming a <a href=\"https:\/\/careerkarma.com\/blog\/how-to-learn-python\/\">Python expert<\/a>!<\/p>\n","protected":false},"excerpt":{"rendered":"The Python assert keyword tests if a condition is true. If a condition is false, the program will stop with an optional message. Assert statements are used to debug code and handle errors. You should not use an assert statement in a production environment. Debugging is a crucial part of programming in any language. When&hellip;","protected":false},"author":240,"featured_media":13202,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[16578],"tags":[],"class_list":{"0":"post-13201","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 Assert Statements: A Step-By-Step Guide | Career Karma<\/title>\n<meta name=\"description\" content=\"The assert statement is a powerful Python debugging tool used to return errors if certain conditions are met. Learn more in this article.\" \/>\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-assert\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python Assert Statements: A Step-By-Step Guide\" \/>\n<meta property=\"og:description\" content=\"The assert statement is a powerful Python debugging tool used to return errors if certain conditions are met. Learn more in this article.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/careerkarma.com\/blog\/python-assert\/\" \/>\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-23T21:41:59+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-01T11:55:59+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/books-business-computer-connection-459654.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=\"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-assert\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-assert\/\"},\"author\":{\"name\":\"James Gallagher\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\"},\"headline\":\"Python Assert Statements: A Step-By-Step Guide\",\"datePublished\":\"2020-07-23T21:41:59+00:00\",\"dateModified\":\"2023-12-01T11:55:59+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-assert\/\"},\"wordCount\":1190,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-assert\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/books-business-computer-connection-459654.jpg\",\"articleSection\":[\"Python\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/careerkarma.com\/blog\/python-assert\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/careerkarma.com\/blog\/python-assert\/\",\"url\":\"https:\/\/careerkarma.com\/blog\/python-assert\/\",\"name\":\"Python Assert Statements: A Step-By-Step Guide | Career Karma\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-assert\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-assert\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/books-business-computer-connection-459654.jpg\",\"datePublished\":\"2020-07-23T21:41:59+00:00\",\"dateModified\":\"2023-12-01T11:55:59+00:00\",\"author\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\"},\"description\":\"The assert statement is a powerful Python debugging tool used to return errors if certain conditions are met. Learn more in this article.\",\"breadcrumb\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-assert\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/careerkarma.com\/blog\/python-assert\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/careerkarma.com\/blog\/python-assert\/#primaryimage\",\"url\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/books-business-computer-connection-459654.jpg\",\"contentUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/books-business-computer-connection-459654.jpg\",\"width\":1020,\"height\":680,\"caption\":\"Python assert\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/careerkarma.com\/blog\/python-assert\/#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 Assert Statements: 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\/#\/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 Assert Statements: A Step-By-Step Guide | Career Karma","description":"The assert statement is a powerful Python debugging tool used to return errors if certain conditions are met. Learn more in this article.","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-assert\/","og_locale":"en_US","og_type":"article","og_title":"Python Assert Statements: A Step-By-Step Guide","og_description":"The assert statement is a powerful Python debugging tool used to return errors if certain conditions are met. Learn more in this article.","og_url":"https:\/\/careerkarma.com\/blog\/python-assert\/","og_site_name":"Career Karma","article_publisher":"http:\/\/facebook.com\/careerkarmaapp","article_published_time":"2020-07-23T21:41:59+00:00","article_modified_time":"2023-12-01T11:55:59+00:00","og_image":[{"width":1020,"height":680,"url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/books-business-computer-connection-459654.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-assert\/#article","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/python-assert\/"},"author":{"name":"James Gallagher","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"headline":"Python Assert Statements: A Step-By-Step Guide","datePublished":"2020-07-23T21:41:59+00:00","dateModified":"2023-12-01T11:55:59+00:00","mainEntityOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/python-assert\/"},"wordCount":1190,"commentCount":0,"image":{"@id":"https:\/\/careerkarma.com\/blog\/python-assert\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/books-business-computer-connection-459654.jpg","articleSection":["Python"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/careerkarma.com\/blog\/python-assert\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/careerkarma.com\/blog\/python-assert\/","url":"https:\/\/careerkarma.com\/blog\/python-assert\/","name":"Python Assert Statements: A Step-By-Step Guide | Career Karma","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/python-assert\/#primaryimage"},"image":{"@id":"https:\/\/careerkarma.com\/blog\/python-assert\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/books-business-computer-connection-459654.jpg","datePublished":"2020-07-23T21:41:59+00:00","dateModified":"2023-12-01T11:55:59+00:00","author":{"@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"description":"The assert statement is a powerful Python debugging tool used to return errors if certain conditions are met. Learn more in this article.","breadcrumb":{"@id":"https:\/\/careerkarma.com\/blog\/python-assert\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/careerkarma.com\/blog\/python-assert\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/python-assert\/#primaryimage","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/books-business-computer-connection-459654.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/03\/books-business-computer-connection-459654.jpg","width":1020,"height":680,"caption":"Python assert"},{"@type":"BreadcrumbList","@id":"https:\/\/careerkarma.com\/blog\/python-assert\/#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 Assert Statements: 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\/#\/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\/13201","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=13201"}],"version-history":[{"count":0,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/13201\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media\/13202"}],"wp:attachment":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media?parent=13201"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/categories?post=13201"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/tags?post=13201"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}