[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-seo-571783-105":3,"detail-sidebar-cat-1-en-105":81,"doc-detail-571783-en":127},{"code":4,"msg":5,"data":6},0,"ok",{"site_id":7,"language":8,"slug":9,"title":10,"keywords":11,"description":12,"schema_data":13,"social_meta":74,"head_meta":76,"extra_data":78,"updated_unix":80},105,"en","python-cheat-sheets-lists-reference","Python cheat sheets - Lists - reference","","Python cheat sheets provide compact reference material for core language elements covered in the unit, combining short explanations, brief notes, syntax summaries, and selected examples. Content is organized into focused categories, including lists, list methods, list functions, and list operators, as well as strings and iteration over sequences. Additional guidance extends beyond the unit with pointers for solving related problems.",{"@graph":14,"@context":73},[15,34,56],{"@type":16,"itemListElement":17},"BreadcrumbList",[18,23,27,31],{"item":19,"name":20,"@type":21,"position":22},"https://docshare.wps.com","Home","ListItem",1,{"item":24,"name":25,"@type":21,"position":26},"https://docshare.wps.com/template/","Template",2,{"item":28,"name":29,"@type":21,"position":30},"https://docshare.wps.com/template/presentations/","Presentations",3,{"item":32,"name":10,"@type":21,"position":33},"https://docshare.wps.com/template/python-cheat-sheets-lists-reference/571783/",4,{"url":32,"name":10,"@type":35,"image":36,"author":41,"headline":10,"publisher":44,"fileFormat":47,"inLanguage":8,"description":12,"dateModified":48,"datePublished":49,"encodingFormat":47,"isAccessibleForFree":50,"interactionStatistic":51},"DigitalDocument",{"url":37,"@type":38,"width":39,"height":40},"https://docshare.wps.com/thumbnails/python-cheat-sheets-lists-reference/571783.png","ImageObject",442,249,{"name":42,"@type":43},"MrHarris58","Person",{"url":19,"name":45,"@type":46},"DocShare","Organization","application/pdf","2026-10-21","2026-10-13",true,{"@type":52,"interactionType":53,"userInteractionCount":55},"InteractionCounter",{"@type":54},"ViewAction",6,{"@type":57,"mainEntity":58},"FAQPage",[59,65,69],{"name":60,"@type":61,"acceptedAnswer":62},"What are Python lists and how do they behave during execution?","Question",{"text":63,"@type":64},"Lists are data structures that hold individual items in an ordered sequence. They are dynamic, so items can be modified, added, or removed while the program runs.","Answer",{"name":66,"@type":61,"acceptedAnswer":67},"How do you access items in a Python list using an index?",{"text":68,"@type":64},"Use list[index] where indexing starts at zero. The index may be a literal number or the value of an expression.",{"name":70,"@type":61,"acceptedAnswer":71},"What are list slices and how can you control them?",{"text":72,"@type":64},"A slice is a new list built from list[start:end:step], including items from the start index up to but not including the end index. You can omit the start or end to use defaults and use step to skip items.","https://schema.org",{"og:url":32,"og:type":75,"og:title":10,"og:site_name":45,"og:description":12},"article",{"robots":77,"canonical":32},"index,follow",{"doc_id":79,"site_id":7},571783,1792033100,{"code":4,"msg":82,"data":83},"success",[84,88,93,98,103,108,113,118,123],{"id":85,"doc_module":22,"doc_module_name":25,"category_name":29,"show_sort_weight":86,"slug":87},11,90,"presentations",{"id":89,"doc_module":22,"doc_module_name":25,"category_name":90,"show_sort_weight":91,"slug":92},12,"Resumes",80,"resumes",{"id":94,"doc_module":22,"doc_module_name":25,"category_name":95,"show_sort_weight":96,"slug":97},14,"Invoices",70,"invoices",{"id":99,"doc_module":22,"doc_module_name":25,"category_name":100,"show_sort_weight":101,"slug":102},15,"Posters",60,"posters",{"id":104,"doc_module":22,"doc_module_name":25,"category_name":105,"show_sort_weight":106,"slug":107},16,"Social Media",50,"social-media",{"id":109,"doc_module":22,"doc_module_name":25,"category_name":110,"show_sort_weight":111,"slug":112},17,"Forms",40,"forms",{"id":114,"doc_module":22,"doc_module_name":25,"category_name":115,"show_sort_weight":116,"slug":117},18,"Letters",30,"letters",{"id":119,"doc_module":22,"doc_module_name":25,"category_name":120,"show_sort_weight":121,"slug":122},21,"Paper Templates",5,"papers-templates",{"id":124,"doc_module":22,"doc_module_name":25,"category_name":125,"show_sort_weight":4,"slug":126},158,"General","general-158",{"code":4,"msg":82,"data":128},{"doc_id":79,"user_id":129,"nickname":42,"user_avatar":130,"doc_module":22,"category_id":85,"category_name":29,"doc_title":10,"doc_description":12,"doc_content":131,"file_id":132,"file_url":133,"file_type":134,"file_size":135,"view_count":55,"is_deleted":4,"is_public":22,"is_downloadable":22,"audit_status":22,"page_count":136,"language":137,"language_code":8,"site_id":7,"html_lang":8,"table_of_contents":138,"faqs":139,"seo_title":140,"seo_description":12,"update_tm":141,"read_time":30},687212988360,"https://ap-avatar.wpscdn.com/davatar_276721f389ce27ea32af1340a28f341c","| Python programming | Handout |\n| --- | --- |\n\nHandout: Python cheat sheets  \nIntroduction  \nThis is a reference for the Python elements covered in this unit. The sheets include short explanations, brief notes, syntax, and selected examples.  \nThe content has been grouped into categories:  \n● Lists  \n● List methods  \n● List functions  \n● List operators  \n● Strings  \n● String functions  \n● String operators  \n● Iterating over sequences  \nThere is also additional information that is not covered in the unit but may be useful in  \nsolving relevant problems. It is signposted with the Explorer icon:   \nLists     \nLists are a type of data structure that involve  \nindividual items organised in a sequence.  \nLists are dynamic data structures: items can  \nbe modified, added, or removed during  \nprogram execution.  \nCreate a list  \nSyntax [comma-separated list of items ]  \nExamples  \nsummer = [\"June\", \"July\", \"August\"]  \nnumbers = []  \ndata = [8, True, \"Hello\", 3 .14]  \nLists are usually assigned when they are created (so they can be referred to and modified later on) .  \nA list can be empty.  \nLists can feature items of different data types.  \nSyntax  \nAccess individual list items  \nlist [index]  \nThe items in a list can be accessed through an index, i. e. their current position in the list, with numbering starting at zero.  \nExamples  \nmonth = summer[0]  \ndata[1] = False  \nprevious = planets[position-1] sum = numbers[i] + numbers[i+1]  \nRetrieve the value of the first item (zero-based index 0) in a list.  \nAssign a new value to the second item (zero-based index 1) in a list.  \nThe index can be the value of an expression.  \nList slices   \nSyntax  \nlist [start index :end index :step]  \nA slice of a list is a new list that includes list items from a start index up to (but not including) an end index. Specifying a step skips over items.  \nExamples  \nsummer = months[5:8] The new list is a slice containing items  \n6 to 8.  \nhead = data[:100] You can omit the start index (start  \nfrom the first item) and the end index (stop at the last item) .  \nskipped = values[::2] Skip every other item.  \nList methods  \nYou can think of list methods as special functions that are applied to lists. To call a list method, you need to use dot notation (as shown in the examples that follow) .  \nAdd or remove items  \nSyntax  \nlist .append(item )  \nAdd an item to the end of the list.  \nExample numbers.append(42)  \nSyntax  \nlist .insert(index ,item )  \nInsert an item at a given (zero-based) index.  \nExample cities.insert(2, \"Oslo\")  \nSyntax  \nExamples  \nSyntax  \nlist .pop(index)  \nRemove the item at the given (zero-based) index in the list, and return it. If no index is specified, remove and return the last item in the list.  \ntasks.pop()  \n\n| last = values.pop() |\n| --- |\n| queue.pop(0) |\n\nlist .remove(item )  \nRemove the first item from the list with a particular value. Raises a ValueError if there is no such item.  \nExample countries. remove(\"Japan\")  \nInsert a new item at the third position (zero-based index 2) in the list.  \n\n| The value removed from the list and returned by pop can be assigned to a variable. |\n| --- |\n| Remove the first item (zero-based index 0) from the list. |\n\nList methods     \nYou can think of list methods as special functions that are applied to lists. To call a list method, you need to use dot notation (as shown in the examples that follow) .  \nFind and count items  \nSyntax  \nlist .index(item )  \nSearch for the first occurrence of an item in the list and return its (zero-based) index. Raises a ValueError if there is no such item.  \nExample pos = planets.index(\"Mars\")  \nSyntax  \nlist .count(item )  \nReturn the number of times an item appears in the list.  \nExample nb_the = words.count(\"the\")  \nOther list operations  \nSyntax  \nExample  \nSyntax  \nlist .reverse()  \nReverse the items of the list.  \nvalues.reverse()  \nlist .sort()  \nSort the items in the list in ascending order.  \nExamples  \n names.sort()  The items can be strings (and sorti","cbCaio6wFOT6eSoX","https://ap.wps.com/l/cbCaio6wFOT6eSoX","pdf",144595,8,"English","# Introduction\n## Lists\n## List slices\n## List methods\n## List functions\n## List operators","[{\"question\":\"What are Python lists and how do they behave during execution?\",\"answer\":\"Lists are data structures that hold individual items in an ordered sequence. They are dynamic, so items can be modified, added, or removed while the program runs.\"},{\"question\":\"How do you access items in a Python list using an index?\",\"answer\":\"Use list[index] where indexing starts at zero. The index may be a literal number or the value of an expression.\"},{\"question\":\"What are list slices and how can you control them?\",\"answer\":\"A slice is a new list built from list[start:end:step], including items from the start index up to but not including the end index. You can omit the start or end to use defaults and use step to skip items.\"}]","Python cheat sheets - Lists - reference | PDF",1791923719]