{"id":17362,"date":"2020-12-08T23:16:39","date_gmt":"2020-12-09T07:16:39","guid":{"rendered":"https:\/\/careerkarma.com\/blog\/?p=17362"},"modified":"2023-12-01T04:05:46","modified_gmt":"2023-12-01T12:05:46","slug":"python-random-choice","status":"publish","type":"post","link":"https:\/\/careerkarma.com\/blog\/python-random-choice\/","title":{"rendered":"Python Random Choice: A How-To Guide"},"content":{"rendered":"\n<p><em>The Python random.choice() method returns an element selected at random from a list. random.choice() works on a list with items in any data type. random.choice() accepts one argument: the list from which you want to select an item.<\/em><\/p>\n\n\n\n<p>You may encounter a scenario where you want to choose an item randomly from a list. For instance, say you\u2019re building a color guessing game. You may want the color the user is guessing to be chosen at random from a list of potential options.<\/p>\n\n\n\n<p>To implement a random choice selector in Python, you can use the <em>random.choice()<\/em> and <em>random.choices()<\/em> function. These functions allow you to retrieve a single random item and multiple random items from a sequence of items, respectively.<\/p>\n\n\n\n<p>This tutorial will discuss, with examples, the basics of the Python random library. We&#8217;ll talk about how to use the <em>random.choice()<\/em> method to retrieve a random element from a list.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Python Random Choice Module<\/h2>\n\n\n\n<p>The Python random module allows you to access functions related to random numbers.<\/p>\n\n\n\n<p>One of the most common uses of this module is to generate a random number, which you can do by using the <em>randint()<\/em> function. The module also provides a function called <em>choice()<\/em>, which allows you to choose, at random, an item from a list.<\/p>\n\n\n\n<p>In addition, random also provides a function called <em>choices()<\/em>, which allows you to return multiple random choices from a list.<\/p>\n\n\n\n<p>Here are a few examples of applications which would use the random library:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>A tool that picks a random number.<\/li><li>A tool that picks a random color from a list of colors.<\/li><li>A tool that chooses a random card from a deck.<\/li><li>An application that flips a coin.<\/li><\/ul>\n\n\n\n<p>We need to import the random library into our code before we can start using the functions in the library. We can do so using the following <a href=\"https:\/\/careerkarma.com\/blog\/python-import\/\">Python import statement<\/a>:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>import random<\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Python random.choice()<\/h2>\n\n\n\n<p>The Python <em>random.choice()<\/em> function returns a random element from a sequence. You must specify the list from which you want to retrieve a random element as an argument. random.choice() returns one value.<\/p>\n\n\n\n<p>The syntax for this function is as follows:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>random.choice(sequence)<\/pre><\/div>\n\n\n\n<p>The random.choice() method can return an item of any data type. So, random.choice() could return a JSON object from a list, or a number.<\/p>\n\n\n\n<p>Let\u2019s walk through an example to illustrate how the random.choice() method works.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">random.choice() Python Example<\/h2>\n\n\n\n<p>Suppose we are building an application that chooses a song at random from our list of favorite songs. This application will help us overcome the dreaded \u201cwhat should I listen to?\u201d question that comes up when choosing a song.<\/p>\n\n\n\n<p>To build this application, we will start with a list of our favorite songs:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>favorite_songs = [&quot;Ring of Fire&quot;, &quot;9 to 5&quot;, &quot;Come on Eileen&quot;, &quot;Everybody Wants to Rule the World&quot;]<\/pre><\/div>\n\n\n\n<p>This list contains four of our favorite songs. Then, we can use <em>random.choice()<\/em> to select a random song from this list. Here\u2019s the code we would use:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>import random \n\nfavorite_songs = [&quot;Ring of Fire&quot;, &quot;9 to 5&quot;, &quot;Come on Eileen&quot;, &quot;Everybody Wants to Rule the World&quot;]\n\nsong_to_play = random.choice(favorite_songs)\nprint(&quot;The song you should play is:&quot;, song_to_play)<\/pre><\/div>\n\n\n\n<p>To illustrate how this program works, we will execute it three times. Here is the response from all three of the occasions on which we executed our program:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>The song you should play is: Ring of Fire\nThe song you should play is: Come on Eileen\nThe song you should play is: Ring of Fire<\/pre><\/div>\n\n\n\n<p>The <em>random.choice()<\/em> method has allowed us to choose a random item from our list of favorite songs.<\/p>\n\n\n\n<p>Let\u2019s break down our code. First, we imported the random module, which includes the <em>choice()<\/em> function that we use later in our program. Then, we declared a list of our favorite songs from which our program should choose one.<\/p>\n\n\n\n<p>Next, we used the <em>choice()<\/em> method to select a random item from our list of favorite songs. We assigned that choice to the variable \u201csong_to_play\u201d. Finally, we printed to the console \u201cThe song you should play is:\u201d, followed by the randomly-selected song we should play.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Random Choice Python: Using random.choices()<\/h2>\n\n\n\n<p>So far, we\u2019ve selected one random choice from a list using the <em>random.choice()<\/em> method. But what if we want to select multiple random choices?<\/p>\n\n\n\n<p>To do so, we can use the <em>random.choices()<\/em> method. This method allows you to return one or more random choices from a list. The syntax for the <em>choices()<\/em> method is:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>random.choices(sequence, weights, accumulate, k=number_to_choose)<\/pre><\/div>\n\n\n\n<p>The <em>choices()<\/em> method accepts the following parameters:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>sequence: The sequence from which you want to choose a random item. This can be a string, list, or a tuple.<\/li><li>weights: A list for you to weigh the likelihood each value appears.<\/li><li>accumulate: A list with weights for each value. The possibility of each weight accumulates.<\/li><li>number_to_choose: The number of random options you want to select from your sequence.<\/li><\/ul>\n\n\n\n<p>We&#8217;re going to focus on the &#8220;sequence&#8221; and &#8220;number_to_choose&#8221; arguments in our examples.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Python random.choices() Example<\/h2>\n\n\n\n<p>Suppose we want to select three songs at random from our list of favorite songs to play. These will all be added to our new playlist of top songs.<\/p>\n\n\n\n<p>The following program allows us to accomplish this task:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>import random \n\nfavorite_songs = [&quot;Ring of Fire&quot;, &quot;9 to 5&quot;, &quot;Come on Eileen&quot;, &quot;Everybody Wants to Rule the World&quot;]\n\nsongs_to_play = random.choices(favorite_songs,  k=3)\n\nfor s in songs_to_play:\n\tprint(s)<\/pre><\/div>\n\n\n\n<p>Our code returns:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>Come on Eileen\n9 to 5\nRing of Fire<\/pre><\/div>\n\n\n\n<p>First, we have imported the random library into our code. Then, we declared a <a href=\"https:\/\/careerkarma.com\/blog\/python-variables\/\">Python variable<\/a> called \u201cfavorite_songs\u201d. This variable stores a list of our favorite songs.<\/p>\n\n\n\n<p>Next, we used the <em>random.choices()<\/em> method to select three songs at random from our list. The <em>random.choices()<\/em> method returned a list of songs.<\/p>\n\n\n\n<p>We used a <a href=\"https:\/\/careerkarma.com\/blog\/python-for-loop\/\">Python for loop<\/a> to go through each item in the list of randomly-generated song options. This loop prints out each option to the console. As you can see, our code returned a list of three songs that we can play, at random.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>The <em>random.choice()<\/em> method selects an item at random from a list. <em>random.choices()<\/em> method selects multiple items at random from a list. Both of these methods can return a value of any data type, such as another list or a number.<\/p>\n\n\n\n<p>This tutorial explored, with reference to examples, how to use these methods to retrieve random items from a list. Now you\u2019re ready to start using these methods like a Python pro!<\/p>\n\n\n\n<p>For advice on top online Python resources, books, and learning resources, check out our <a href=\"https:\/\/careerkarma.com\/blog\/how-to-learn-python\/\">How to Learn Python guide<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"The Python random.choice() method returns an element selected at random from a list. random.choice() works on a list with items in any data type. random.choice() accepts one argument: the list from which you want to select an item. You may encounter a scenario where you want to choose an item randomly from a list. For&hellip;","protected":false},"author":240,"featured_media":17363,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[16578],"tags":[],"class_list":{"0":"post-17362","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 Random Choice: A How-To Guide | Career Karma<\/title>\n<meta name=\"description\" content=\"On Career Karma, learn how to use Python random.choice() and random.choices(), two functions that allow you to choose a random item from a list.\" \/>\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-random-choice\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python Random Choice: A How-To Guide\" \/>\n<meta property=\"og:description\" content=\"On Career Karma, learn how to use Python random.choice() and random.choices(), two functions that allow you to choose a random item from a list.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/careerkarma.com\/blog\/python-random-choice\/\" \/>\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-12-09T07:16:39+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-01T12:05:46+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/05\/lines-of-code-2653362.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-random-choice\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-random-choice\/\"},\"author\":{\"name\":\"James Gallagher\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\"},\"headline\":\"Python Random Choice: A How-To Guide\",\"datePublished\":\"2020-12-09T07:16:39+00:00\",\"dateModified\":\"2023-12-01T12:05:46+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-random-choice\/\"},\"wordCount\":1011,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-random-choice\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/05\/lines-of-code-2653362.jpg\",\"articleSection\":[\"Python\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/careerkarma.com\/blog\/python-random-choice\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/careerkarma.com\/blog\/python-random-choice\/\",\"url\":\"https:\/\/careerkarma.com\/blog\/python-random-choice\/\",\"name\":\"Python Random Choice: A How-To Guide | Career Karma\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-random-choice\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-random-choice\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/05\/lines-of-code-2653362.jpg\",\"datePublished\":\"2020-12-09T07:16:39+00:00\",\"dateModified\":\"2023-12-01T12:05:46+00:00\",\"author\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\"},\"description\":\"On Career Karma, learn how to use Python random.choice() and random.choices(), two functions that allow you to choose a random item from a list.\",\"breadcrumb\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-random-choice\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/careerkarma.com\/blog\/python-random-choice\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/careerkarma.com\/blog\/python-random-choice\/#primaryimage\",\"url\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/05\/lines-of-code-2653362.jpg\",\"contentUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/05\/lines-of-code-2653362.jpg\",\"width\":1020,\"height\":680},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/careerkarma.com\/blog\/python-random-choice\/#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 Random Choice: A How-To 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 Random Choice: A How-To Guide | Career Karma","description":"On Career Karma, learn how to use Python random.choice() and random.choices(), two functions that allow you to choose a random item from a list.","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-random-choice\/","og_locale":"en_US","og_type":"article","og_title":"Python Random Choice: A How-To Guide","og_description":"On Career Karma, learn how to use Python random.choice() and random.choices(), two functions that allow you to choose a random item from a list.","og_url":"https:\/\/careerkarma.com\/blog\/python-random-choice\/","og_site_name":"Career Karma","article_publisher":"http:\/\/facebook.com\/careerkarmaapp","article_published_time":"2020-12-09T07:16:39+00:00","article_modified_time":"2023-12-01T12:05:46+00:00","og_image":[{"width":1020,"height":680,"url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/05\/lines-of-code-2653362.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-random-choice\/#article","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/python-random-choice\/"},"author":{"name":"James Gallagher","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"headline":"Python Random Choice: A How-To Guide","datePublished":"2020-12-09T07:16:39+00:00","dateModified":"2023-12-01T12:05:46+00:00","mainEntityOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/python-random-choice\/"},"wordCount":1011,"commentCount":0,"image":{"@id":"https:\/\/careerkarma.com\/blog\/python-random-choice\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/05\/lines-of-code-2653362.jpg","articleSection":["Python"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/careerkarma.com\/blog\/python-random-choice\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/careerkarma.com\/blog\/python-random-choice\/","url":"https:\/\/careerkarma.com\/blog\/python-random-choice\/","name":"Python Random Choice: A How-To Guide | Career Karma","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/python-random-choice\/#primaryimage"},"image":{"@id":"https:\/\/careerkarma.com\/blog\/python-random-choice\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/05\/lines-of-code-2653362.jpg","datePublished":"2020-12-09T07:16:39+00:00","dateModified":"2023-12-01T12:05:46+00:00","author":{"@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"description":"On Career Karma, learn how to use Python random.choice() and random.choices(), two functions that allow you to choose a random item from a list.","breadcrumb":{"@id":"https:\/\/careerkarma.com\/blog\/python-random-choice\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/careerkarma.com\/blog\/python-random-choice\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/python-random-choice\/#primaryimage","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/05\/lines-of-code-2653362.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/05\/lines-of-code-2653362.jpg","width":1020,"height":680},{"@type":"BreadcrumbList","@id":"https:\/\/careerkarma.com\/blog\/python-random-choice\/#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 Random Choice: A How-To 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\/17362","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=17362"}],"version-history":[{"count":0,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/17362\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media\/17363"}],"wp:attachment":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media?parent=17362"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/categories?post=17362"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/tags?post=17362"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}