{"id":21276,"date":"2020-08-17T11:15:57","date_gmt":"2020-08-17T18:15:57","guid":{"rendered":"https:\/\/careerkarma.com\/blog\/?p=21276"},"modified":"2023-12-01T03:57:58","modified_gmt":"2023-12-01T11:57:58","slug":"python-find-in-list","status":"publish","type":"post","link":"https:\/\/careerkarma.com\/blog\/python-find-in-list\/","title":{"rendered":"Python Find in List: A Beginner\u2019s Guide"},"content":{"rendered":"\n<p>How do you find an item in a Python list? It\u2019s a question all Python coders encounter at some point. Luckily, the language offers a number of ways in which you can find an item in a list, such as using the <code>in<\/code> operator or a linear search.<br><\/p>\n\n\n\n<p>In this guide, we talk about four methods of finding an item in a list. We walk through an example of each of these methods so you can learn how they work.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Python Find in List Using \u201cin\u201d<\/h2>\n\n\n\n<p>Python has a special operator called <code>in<\/code>. This operator checks to see whether a value is in a list. This operator is sometimes referred to as a \u201cmembership operator\u201d because it checks whether a value is a member of a list.<br><\/p>\n\n\n\n<p>In this example, we run a shoe store and we want to check whether a particular shoe is in stock. One way to do this is to use the <code>in<\/code> operator.<br><\/p>\n\n\n\n<p>Start by defining a list of shoes:&nbsp;<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>shoes = [&quot;Adidas ZX Flux&quot;, &quot;Adidas Ultraboost&quot;, &quot;Adidas Gazelle&quot;, &quot;Adidas Runfalcon&quot;]<\/pre><\/div>\n\n\n\n<p>Next, we ask a user to insert a shoe to find:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>to_find = input(&quot;What shoe are you looking for? &quot;)<\/pre><\/div>\n\n\n\n<p>We use an <a href=\"https:\/\/careerkarma.com\/blog\/python-input\/\">input() statement<\/a> to collect the name of the shoe. Next, we use an <a href=\"https:\/\/careerkarma.com\/blog\/python-if-else\/\">&#8220;if&#8221; statement<\/a> to check whether the shoe a user has entered is in our list of shoes:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>if to_find in shoes:\n\tprint(&quot;{} shoes are in stock.&quot;.format(to_find))\nelse:\n\tprint(&quot;{} shoes are not in stock.&quot;.format(to_find))<\/pre><\/div>\n\n\n\n<p>Our <code>if<\/code> statement will execute if the shoe a user enters can be found in our list. Otherwise, the <code>else<\/code> statement will run. Give our code a try:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>What shoe are you looking for? Adidas Runfalcon\nAdidas Runfalcon shoes are in stock.<\/pre><\/div>\n\n\n\n<p>Our code successfully identifies that \u201cAdidas Runfalcon\u201d shoes are in stock. This causes our <code>if<\/code> statement to execute.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Python Find in List Using a Linear Search<\/h2>\n\n\n\n<p>A linear search is a simple searching algorithm that finds an item in a list. A linear search starts at one end of a list and compares a value with every element in the list. If that value is in the list, a linear search returns the position of the item.<br><\/p>\n\n\n\n<p>Start by writing a <a href=\"https:\/\/careerkarma.com\/blog\/python-functions\/\">function<\/a> that performs our linear search:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>def linear_search(array, to_find):\n\tfor i in range(0, len(array)):\n\t\tif array[i] == to_find:\n\t\t\treturn i\n\treturn -1<\/pre><\/div>\n\n\n\n<p>Our code uses a \u201cfor\u201d loop to iterate through every item in the \u201carray\u201d list. If that item is found, the index position of that item is returned to the main program. If the item is not found after the entire list has been searched, -1 is returned to the main program.<br><\/p>\n\n\n\n<p>Let\u2019s go to our main program and call our function:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>shoes = [&quot;Adidas ZX Flux&quot;, &quot;Adidas Ultraboost&quot;, &quot;Adidas Gazelle&quot;, &quot;Adidas Runfalcon&quot;]\nto_find = input(&quot;What shoe are you looking for? &quot;)\n\nfound = linear_search(shoes, to_find)<\/pre><\/div>\n\n\n\n<p>This code asks the user for the shoe they are looking for. Then, our code calls the linear_search function to find whether that shoe is present in the list.<br><\/p>\n\n\n\n<p>Finally, we use an <code>if<\/code> statement to inform a user whether the shoe has been found:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>if found != -1:\n\tprint(&quot;{} shoes are in stock.&quot;.format(to_find))\nelse:\n\tprint(&quot;{} shoes are not in stock.&quot;.format(to_find))<\/pre><\/div>\n\n\n\n<p>If our linear_search function returns -1, that means that an item has not been found in a list. Our <code>if<\/code> statement will run if the value returned by the linear_search function is not equal to -1. If the value is equal to -1, the <code>else<\/code> statement will run.<br><\/p>\n\n\n\n<p>Try to run our code:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>What shoe are you looking for? Adidas Samba\nAdidas Samba shoes are not in stock.<\/pre><\/div>\n\n\n\n<p>Our code cannot find Adidas Samba shoes in our list.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Python Find in List Using index()<\/h2>\n\n\n\n<p>The <a href=\"https:\/\/careerkarma.com\/blog\/python-index\/\">index() built-in function<\/a> lets you find the index position of an item in a list. Write a program that finds the location of a shoe in a list using <code>index()<\/code>.<br><\/p>\n\n\n\n<p>To start, define a list of shoes. We ask a user to insert a shoe for which our program will search in our list of shoes:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>shoes = [&quot;Adidas ZX Flux&quot;, &quot;Adidas Ultraboost&quot;, &quot;Adidas Gazelle&quot;, &quot;Adidas Runfalcon&quot;]\nto_find = input(&quot;What shoe are you looking for? &quot;)<\/pre><\/div>\n\n\n\n<p>Next, we use the <code>index()<\/code> method to return the list index position of that shoe:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>try:\n\tfound = shoes.index(to_find)\n\tprint(&quot;{} shoes are in stock. They are at index position {} in the list of shoes.&quot;.format(to_find, found))\nexcept:\n\tprint(&quot;{} shoes are not in stock.&quot;.format(to_find))<\/pre><\/div>\n\n\n\n<p>The <code>index()<\/code> method returns a ValueError if an item is not found in a list. That\u2019s why we use it as part of a \u201ctry&#8230;except\u201d block.<br><\/p>\n\n\n\n<p>If a shoe cannot be found, a ValueError is raised. At this point, the \u201cexcept\u201d block will be run. If a shoe is found, the \u201ctry\u201d block will execute successfully.<br><\/p>\n\n\n\n<p>Run our code:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>What shoe are you looking for? Adidas Gazelle\nAdidas Gazelle shoes are in stock. They are at index position 2 in the list of shoes.<\/pre><\/div>\n\n\n\n<p>Our code successfully identifies that Adidas Gazelle shoes are in stock. Our program also tells us the position at which those shoes are stored in our list.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Python Find in List Using a List Comprehension<\/h2>\n\n\n\n<p>You find multiple items in a list that meet a certain condition using a <a href=\"https:\/\/careerkarma.com\/blog\/python-list-comprehension\/\">list comprehension<\/a>.<br><\/p>\n\n\n\n<p>We have a list of shoes and we only want to return those that are branded Adidas. We can do this using a list comprehension. Start by defining a list of shoes:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>shoes = [&quot;Nike PG 4&quot;, &quot;Adidas Ultraboost&quot;, &quot;Adidas Gazelle&quot;, &quot;Nike Air Max Verona&quot;]<\/pre><\/div>\n\n\n\n<p>Next, we write a list comprehension that retrieves all the shoes that contain the word \u201cNike\u201d. List comprehensions use a syntax similar to a <a href=\"https:\/\/careerkarma.com\/blog\/python-for-loop\/\">for loop<\/a>:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>nike_shoes = [shoe for shoe in shoes if &quot;Nike&quot; in shoe]\nprint(nike_shoes)<\/pre><\/div>\n\n\n\n<p>The list expression iterates through every shoe in the \u201cshoe\u201d list. The expression checks if the word Nike is in each shoe name. If it is, that shoe is added to the \u201cnike_shoes\u201d list. Otherwise, nothing happens.<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>['Nike PG 4', 'Nike Air Max Verona']<\/pre><\/div>\n\n\n\n<p>Our code returns a list of Nike shoes.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>There are many ways in which you can find an item in a list. The most popular methods include:<br><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Using the <code>in<\/code> membership operator<\/li><li>Using a linear search<\/li><li>Using the <code>index()<\/code> method<\/li><li>Using a list comprehension<\/li><\/ul>\n\n\n\n<p>Now you\u2019re ready to search for items in a Python list like an expert coder!<\/p>\n","protected":false},"excerpt":{"rendered":"How do you find an item in a Python list? It\u2019s a question all Python coders encounter at some point. Luckily, the language offers a number of ways in which you can find an item in a list, such as using the in operator or a linear search. In this guide, we talk about four&hellip;","protected":false},"author":240,"featured_media":21277,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[16578],"tags":[],"class_list":{"0":"post-21276","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 Find in List: A Beginner\u2019s Guide | Career Karma<\/title>\n<meta name=\"description\" content=\"On Career Karma, learn how to find items in a Python list using \u201cin\u201d, a linear search, the index() method, and a list comprehension.\" \/>\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-find-in-list\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python Find in List: A Beginner\u2019s Guide\" \/>\n<meta property=\"og:description\" content=\"On Career Karma, learn how to find items in a Python list using \u201cin\u201d, a linear search, the index() method, and a list comprehension.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/careerkarma.com\/blog\/python-find-in-list\/\" \/>\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-17T18:15:57+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-01T11:57:58+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/08\/nikita-kachanovsky-OVbeSXRk_9E-unsplash.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1020\" \/>\n\t<meta property=\"og:image:height\" content=\"699\" \/>\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-find-in-list\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-find-in-list\/\"},\"author\":{\"name\":\"James Gallagher\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\"},\"headline\":\"Python Find in List: A Beginner\u2019s Guide\",\"datePublished\":\"2020-08-17T18:15:57+00:00\",\"dateModified\":\"2023-12-01T11:57:58+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-find-in-list\/\"},\"wordCount\":847,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-find-in-list\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/08\/nikita-kachanovsky-OVbeSXRk_9E-unsplash.jpg\",\"articleSection\":[\"Python\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/careerkarma.com\/blog\/python-find-in-list\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/careerkarma.com\/blog\/python-find-in-list\/\",\"url\":\"https:\/\/careerkarma.com\/blog\/python-find-in-list\/\",\"name\":\"Python Find in List: A Beginner\u2019s Guide | Career Karma\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-find-in-list\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-find-in-list\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/08\/nikita-kachanovsky-OVbeSXRk_9E-unsplash.jpg\",\"datePublished\":\"2020-08-17T18:15:57+00:00\",\"dateModified\":\"2023-12-01T11:57:58+00:00\",\"author\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\"},\"description\":\"On Career Karma, learn how to find items in a Python list using \u201cin\u201d, a linear search, the index() method, and a list comprehension.\",\"breadcrumb\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-find-in-list\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/careerkarma.com\/blog\/python-find-in-list\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/careerkarma.com\/blog\/python-find-in-list\/#primaryimage\",\"url\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/08\/nikita-kachanovsky-OVbeSXRk_9E-unsplash.jpg\",\"contentUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/08\/nikita-kachanovsky-OVbeSXRk_9E-unsplash.jpg\",\"width\":1020,\"height\":699},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/careerkarma.com\/blog\/python-find-in-list\/#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 Find in List: A Beginner\u2019s 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 Find in List: A Beginner\u2019s Guide | Career Karma","description":"On Career Karma, learn how to find items in a Python list using \u201cin\u201d, a linear search, the index() method, and a list comprehension.","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-find-in-list\/","og_locale":"en_US","og_type":"article","og_title":"Python Find in List: A Beginner\u2019s Guide","og_description":"On Career Karma, learn how to find items in a Python list using \u201cin\u201d, a linear search, the index() method, and a list comprehension.","og_url":"https:\/\/careerkarma.com\/blog\/python-find-in-list\/","og_site_name":"Career Karma","article_publisher":"http:\/\/facebook.com\/careerkarmaapp","article_published_time":"2020-08-17T18:15:57+00:00","article_modified_time":"2023-12-01T11:57:58+00:00","og_image":[{"width":1020,"height":699,"url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/08\/nikita-kachanovsky-OVbeSXRk_9E-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":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/careerkarma.com\/blog\/python-find-in-list\/#article","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/python-find-in-list\/"},"author":{"name":"James Gallagher","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"headline":"Python Find in List: A Beginner\u2019s Guide","datePublished":"2020-08-17T18:15:57+00:00","dateModified":"2023-12-01T11:57:58+00:00","mainEntityOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/python-find-in-list\/"},"wordCount":847,"commentCount":0,"image":{"@id":"https:\/\/careerkarma.com\/blog\/python-find-in-list\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/08\/nikita-kachanovsky-OVbeSXRk_9E-unsplash.jpg","articleSection":["Python"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/careerkarma.com\/blog\/python-find-in-list\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/careerkarma.com\/blog\/python-find-in-list\/","url":"https:\/\/careerkarma.com\/blog\/python-find-in-list\/","name":"Python Find in List: A Beginner\u2019s Guide | Career Karma","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/python-find-in-list\/#primaryimage"},"image":{"@id":"https:\/\/careerkarma.com\/blog\/python-find-in-list\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/08\/nikita-kachanovsky-OVbeSXRk_9E-unsplash.jpg","datePublished":"2020-08-17T18:15:57+00:00","dateModified":"2023-12-01T11:57:58+00:00","author":{"@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"description":"On Career Karma, learn how to find items in a Python list using \u201cin\u201d, a linear search, the index() method, and a list comprehension.","breadcrumb":{"@id":"https:\/\/careerkarma.com\/blog\/python-find-in-list\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/careerkarma.com\/blog\/python-find-in-list\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/python-find-in-list\/#primaryimage","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/08\/nikita-kachanovsky-OVbeSXRk_9E-unsplash.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/08\/nikita-kachanovsky-OVbeSXRk_9E-unsplash.jpg","width":1020,"height":699},{"@type":"BreadcrumbList","@id":"https:\/\/careerkarma.com\/blog\/python-find-in-list\/#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 Find in List: A Beginner\u2019s 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\/21276","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=21276"}],"version-history":[{"count":0,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/21276\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media\/21277"}],"wp:attachment":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media?parent=21276"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/categories?post=21276"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/tags?post=21276"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}