{"id":111539,"date":"2020-04-14T12:51:12","date_gmt":"2020-04-14T12:51:12","guid":{"rendered":"https:\/\/blog.finxter.com\/?p=7543"},"modified":"2020-04-14T12:51:12","modified_gmt":"2020-04-14T12:51:12","slug":"python-list-methods-cheat-sheet-instant-pdf-download","status":"publish","type":"post","link":"https:\/\/sickgaming.net\/blog\/2020\/04\/14\/python-list-methods-cheat-sheet-instant-pdf-download\/","title":{"rendered":"Python List Methods Cheat Sheet [Instant PDF Download]"},"content":{"rendered":"<p>Here&#8217;s your free PDF cheat sheet showing you all Python list methods on one simple page. Click the image to download the high-resolution PDF file, print it, and post it to your office wall:<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/blog.finxter.com\/wp-content\/uploads\/2020\/04\/Python-List-Methods-Cheat-Sheet.pdf\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/blog.finxter.com\/wp-content\/uploads\/2020\/04\/Python-List-Methods-Cheat-Sheet.jpg\" alt=\"\" class=\"wp-image-7544\" srcset=\"https:\/\/blog.finxter.com\/wp-content\/uploads\/2020\/04\/Python-List-Methods-Cheat-Sheet.jpg 670w, https:\/\/blog.finxter.com\/wp-content\/uploads\/2020\/04\/Python-List-Methods-Cheat-Sheet-231x300.jpg 231w\" sizes=\"(max-width: 670px) 100vw, 670px\" \/><\/a><\/figure>\n<\/div>\n<div class=\"wp-block-buttons aligncenter\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link has-background has-vivid-cyan-blue-background-color\" href=\"https:\/\/blog.finxter.com\/wp-content\/uploads\/2020\/04\/Python-List-Methods-Cheat-Sheet.pdf\" style=\"border-radius:9px\" target=\"_blank\" rel=\"noreferrer noopener\">Instant PDF Download [100% FREE]<\/a><\/div>\n<\/div>\n<p>I&#8217;ll lead you through all <a href=\"https:\/\/blog.finxter.com\/python-list-methods\/\" target=\"_blank\" rel=\"noreferrer noopener\">Python list methods<\/a> in this short video tutorial:<\/p>\n<figure class=\"wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\">\n<div class=\"wp-block-embed__wrapper\">\n<div class=\"ast-oembed-container\"><iframe loading=\"lazy\" title=\"Python List Methods\" width=\"1400\" height=\"788\" src=\"https:\/\/www.youtube.com\/embed\/4j8B9a_kZY4?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/div>\n<\/div>\n<\/figure>\n<p>If you want to study the methods yourself, have a look at the following table from <a href=\"https:\/\/blog.finxter.com\/python-lists\/\" target=\"_blank\" rel=\"noreferrer noopener\">my blog article<\/a>:<\/p>\n<figure class=\"wp-block-table is-style-stripes\">\n<table>\n<thead>\n<tr>\n<th>Method<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code><a href=\"https:\/\/blog.finxter.com\/python-list-append\/\" target=\"_blank\" rel=\"noreferrer noopener\">lst.append(x)<\/a><\/code><\/td>\n<td>Appends element <code>x<\/code> to the list <code>lst<\/code>.<\/td>\n<\/tr>\n<tr>\n<td><code><a href=\"https:\/\/blog.finxter.com\/python-list-clear\/\" target=\"_blank\" rel=\"noreferrer noopener\"><code>lst<\/code>.clear()<\/a><\/code><\/td>\n<td>Removes all elements from the list <code>lst<\/code>&#8211;which becomes empty.<\/td>\n<\/tr>\n<tr>\n<td><code><a href=\"https:\/\/blog.finxter.com\/python-list-copy\/\" target=\"_blank\" rel=\"noreferrer noopener\">lst.copy()<\/a><\/code><\/td>\n<td>Returns a copy of the list <code>lst<\/code>. Copies only the list, not the elements in the list (shallow copy).<\/td>\n<\/tr>\n<tr>\n<td><code><a href=\"https:\/\/blog.finxter.com\/python-list-count\/\" target=\"_blank\" rel=\"noreferrer noopener\">lst.count(x)<\/a><\/code><\/td>\n<td>Counts the number of occurrences of element <code>x<\/code> in the list <code>lst<\/code>.<\/td>\n<\/tr>\n<tr>\n<td><code><a href=\"https:\/\/blog.finxter.com\/python-list-extend\/\" target=\"_blank\" rel=\"noreferrer noopener\">lst.extend(iter)<\/a><\/code><\/td>\n<td>Adds all elements of an iterable <code>iter<\/code>(e.g. another list) to the list <code>lst<\/code>. <\/td>\n<\/tr>\n<tr>\n<td><code><a href=\"https:\/\/blog.finxter.com\/python-list-index\/\" target=\"_blank\" rel=\"noreferrer noopener\">lst.index(x)<\/a><\/code><\/td>\n<td>Returns the position (index) of the first occurrence of value <code>x<\/code> in the list <code>lst<\/code>. <\/td>\n<\/tr>\n<tr>\n<td><code><a href=\"https:\/\/blog.finxter.com\/python-list-insert-method\/\" target=\"_blank\" rel=\"noreferrer noopener\">lst.insert(i, x)<\/a><\/code><\/td>\n<td>Inserts element <code>x<\/code> at position (index) <code>i<\/code> in the list <code>lst<\/code>.<\/td>\n<\/tr>\n<tr>\n<td><code><a href=\"https:\/\/blog.finxter.com\/python-list-pop\/\" target=\"_blank\" rel=\"noreferrer noopener\">lst.pop()<\/a><\/code><\/td>\n<td>Removes and returns the final element of the list <code>lst<\/code>. <\/td>\n<\/tr>\n<tr>\n<td><code><a href=\"https:\/\/blog.finxter.com\/python-list-remove\/\" target=\"_blank\" rel=\"noreferrer noopener\">lst.remove(x)<\/a><\/code><\/td>\n<td>Removes and returns the first occurrence of element <code>x<\/code> in the list <code>lst<\/code>. <\/td>\n<\/tr>\n<tr>\n<td><code><a href=\"https:\/\/blog.finxter.com\/python-list-reverse\/\" target=\"_blank\" rel=\"noreferrer noopener\">lst.reverse()<\/a><\/code><\/td>\n<td>Reverses the order of elements in the list <code>lst<\/code>. <\/td>\n<\/tr>\n<tr>\n<td><code><a href=\"https:\/\/blog.finxter.com\/python-list-sort\/\" target=\"_blank\" rel=\"noreferrer noopener\">lst.sort()<\/a><\/code><\/td>\n<td>Sorts the elements in the list <code>lst<\/code> in ascending order.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<p><strong>Go ahead and try the Python list methods yourself:<\/strong><\/p>\n<p> <iframe loading=\"lazy\" src=\"https:\/\/repl.it\/repls\/UnevenHoneydewOctagon?lite=true\" scrolling=\"no\" allowtransparency=\"true\" allowfullscreen=\"true\" sandbox=\"allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals\" width=\"100%\" height=\"1100px\" frameborder=\"no\"><\/iframe> <\/p>\n<p><strong><em>Puzzle: Can you figure out all outputs of this interactive Python script?<\/em><\/strong><\/p>\n<p>If you&#8217;ve studied the table carefully, you&#8217;ll know the most important list methods in Python. Let&#8217;s have a look at some examples of above methods:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">>>> l = []\n>>> l.append(2)\n>>> l\n[2]\n>>> l.clear()\n>>> l\n[]\n>>> l.append(2)\n>>> l\n[2]\n>>> l.copy()\n[2]\n>>> l.count(2)\n1\n>>> l.extend([2,3,4])\n>>> l\n[2, 2, 3, 4]\n>>> l.index(3)\n2\n>>> l.insert(2, 99)\n>>> l\n[2, 2, 99, 3, 4]\n>>> l.pop()\n4\n>>> l.remove(2)\n>>> l\n[2, 99, 3]\n>>> l.reverse()\n>>> l\n[3, 99, 2]\n>>> l.sort()\n>>> l\n[2, 3, 99]<\/pre>\n<h2>Where to Go From Here?<\/h2>\n<p>Want more cheat sheets? Excellent. I believe learning with cheat sheets is one of the most efficient learning techniques. <a href=\"https:\/\/blog.finxter.com\/subscribe\/\" target=\"_blank\" rel=\"noreferrer noopener\">Join my free Python email list <\/a>where I&#8217;ll send you more than 10 new Python cheat sheets and regular Python courses for continuous improvement. It&#8217;s free!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here&#8217;s your free PDF cheat sheet showing you all Python list methods on one simple page. Click the image to download the high-resolution PDF file, print it, and post it to your office wall: Instant PDF Download [100% FREE] I&#8217;ll lead you through all Python list methods in this short video tutorial: If you want [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[857],"tags":[73,468,528],"class_list":["post-111539","post","type-post","status-publish","format-standard","hentry","category-python-tut","tag-programming","tag-python","tag-tutorial"],"_links":{"self":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/posts\/111539","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/comments?post=111539"}],"version-history":[{"count":0,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/posts\/111539\/revisions"}],"wp:attachment":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/media?parent=111539"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/categories?post=111539"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/tags?post=111539"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}