[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-seo-685774-105":3,"detail-sidebar-cat-0-en-105":81,"doc-detail-685774-en":130,"doc-similar-685774":152},{"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","unit-2-lists-dictionaries-and-sets","UNIT 2 - Lists, Dictionaries And Sets","","Unit 2 focuses on core Python data structures: lists, dictionaries, and sets, with a strong emphasis on how lists work in practice. It introduces list properties such as zero-based indexing, linear ordering, and mutability, then explains list traversal and common list operations including retrieve, replace, delete, insert, append, sort, reverse, extend, len, min, and max. It also covers tuple fundamentals, contrasting immutability with lists and demonstrating key tuple operations like indexing, negative indexing, slicing, concatenation, length, and min/max.",{"@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/document/","Document",2,{"item":28,"name":29,"@type":21,"position":30},"https://docshare.wps.com/document/exam/","Exam",3,{"item":32,"name":10,"@type":21,"position":33},"https://docshare.wps.com/document/unit-2-lists-dictionaries-and-sets/685774/",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/unit-2-lists-dictionaries-and-sets/685774.png","ImageObject",300,407,{"name":42,"@type":43},"Kyle","Person",{"url":19,"name":45,"@type":46},"DocShare","Organization","application/pdf","2026-11-26","2026-11-07",true,{"@type":52,"interactionType":53,"userInteractionCount":55},"InteractionCounter",{"@type":54},"ViewAction",8,{"@type":57,"mainEntity":58},"FAQPage",[59,65,69],{"name":60,"@type":61,"acceptedAnswer":62},"What is a Python list and how is indexing handled?","Question",{"text":63,"@type":64},"A list is a mutable, linear data structure that allows variable length and mixed-type elements. List items use zero-based indexing, meaning the first element has index 0.","Answer",{"name":66,"@type":61,"acceptedAnswer":67},"How can elements in a list be accessed and traversed?",{"text":68,"@type":64},"List traversal accesses elements one-by-one, usually starting from the first element and ending at the last. Elements can be accessed using their index value inside square brackets.",{"name":70,"@type":61,"acceptedAnswer":71},"What makes tuples different from lists in Python?",{"text":72,"@type":64},"Tuples are immutable, so once created they cannot be altered. Delete, update, insert, and append operations defined for lists are not applicable to tuples.","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},685774,1794018222,{"code":4,"msg":82,"data":83},"success",[84,88,92,95,100,105,110,114,119,122,126],{"id":22,"doc_module":4,"doc_module_name":25,"category_name":85,"show_sort_weight":86,"slug":87},"Story & Novel",90,"story-novel",{"id":26,"doc_module":4,"doc_module_name":25,"category_name":89,"show_sort_weight":90,"slug":91},"Literature",80,"literature",{"id":33,"doc_module":4,"doc_module_name":25,"category_name":29,"show_sort_weight":93,"slug":94},70,"exam",{"id":96,"doc_module":4,"doc_module_name":25,"category_name":97,"show_sort_weight":98,"slug":99},5,"Comic",60,"comic",{"id":101,"doc_module":4,"doc_module_name":25,"category_name":102,"show_sort_weight":103,"slug":104},6,"Technology",50,"technology",{"id":106,"doc_module":4,"doc_module_name":25,"category_name":107,"show_sort_weight":108,"slug":109},7,"Healthcare",40,"healthcare",{"id":55,"doc_module":4,"doc_module_name":25,"category_name":111,"show_sort_weight":112,"slug":113},"Research & Report",30,"research-report",{"id":115,"doc_module":4,"doc_module_name":25,"category_name":116,"show_sort_weight":117,"slug":118},9,"Religion & Spirituality",20,"religion-spirituality",{"id":117,"doc_module":4,"doc_module_name":25,"category_name":120,"show_sort_weight":117,"slug":121},"World Cup","world-cup",{"id":123,"doc_module":4,"doc_module_name":25,"category_name":124,"show_sort_weight":123,"slug":125},10,"Lifestyle","lifestyle",{"id":127,"doc_module":4,"doc_module_name":25,"category_name":128,"show_sort_weight":96,"slug":129},19,"General","general",{"code":4,"msg":82,"data":131},{"doc_id":79,"user_id":132,"nickname":42,"user_avatar":133,"doc_module":4,"category_id":33,"category_name":29,"doc_title":10,"doc_description":12,"doc_content":134,"file_id":135,"file_url":136,"file_type":137,"file_size":138,"view_count":55,"is_deleted":4,"is_public":22,"is_downloadable":22,"audit_status":22,"page_count":117,"language":139,"language_code":8,"site_id":7,"html_lang":8,"table_of_contents":140,"faqs":141,"seo_title":142,"seo_description":12,"update_tm":80,"read_time":103,"preview_page_count":26,"preview_urls":143},3985741905716,"https://ap-avatar.wpscdn.com/davatar_994ba38a5ba835b3df7d355c54d3ed8d","UNIT 2 Lists, Dictionaries And Sets  \nLists: List structures-Common list operations-List traversal-Lists in Python-Python list type –Tuples – sequences-Nested lists-Iterating over lists in python.  \nDictionaries and Sets: Dictionary types in Python-Set data type-Strings and its operations.  \n2.1 List  \n2.1.1 List structures:  \n• A list is a linear data structure , meaning that its elements have a linear ordering.  \n• Each item in the list is identified by its index value .  \n• To begin numbering sequences of items with an index value of 0 . This is referred to as zero-based indexing .  \n• 0 index has value 100, 1 index has value 200 etc.  \nIndex  Value   \n0  100  1  200  2  300  3  400  4 500  \n2.1.2 List Traversal  \n• A list traversal is a means of accessing, one-by-one, the elements of a list.  \n• Each element can be accessed one-by-one, starting with the first,and ending with the last element.  \n• Similarly, the list could be traversed starting with the last element and ending with the first.  \n2.1.3 Python List Type  \n• A list in Python is a mutable, linear data structure of variable length and allowing mixedtype elements.  \n• Mutable means that the contents ofthe list may be altered.  \n• Lists in Python use zero based indexing.  \n▪ Example; [1, 2, 3]  \n['one', 'two', 'three']  \n['apples', 50, True]  \n• Thus, all lists have index values 0 ... n-1, where n is the number of elements in the list.  \n• Lists are denoted by a comma-separated list of elements within square brackets.  \n• An empty list is denoted by an empty pair of square brackets, [] .  \n2.1.4. List Operations  \n• Operations commonly performed on lists include retrieve, update, insert, delete (remove) and append.  \n1.Retrieve operation:  \n• Elements of a list are accessed by using an index value within square brackets.  \n• Example:  \nli = [1, 2, 3]  \n▪ li [0] ➝ 1 access of first element  \n▪ li [1] ➝ 2 access of second element  \n▪ l i[2] ➝ 3 access of third element  \n• The elements in list li can be summed as follows,  \n▪ sum = li[0] + li[1] + li[2]  \n▪ print(sum) -> o/p is 6  \n2.Replace operation:  \n• Elements ofa list can be updated (replaced)  \n• Example:  \nli=[1, 2, 3]  \n▪ li[2] = 4 o/p : [1, 2, 4] replacement of 3 with 4 at index 2  \n3. Delete operation:  \n• Elements ofa list can be deleted (removed)  \n• Example:  \nli=[1, 2, 3]  \n▪ del li[2] o/p : [1, 2] removal of 4 at index 2  \n4.Insert operation:  \n• Insert provide a means of inserting/adding elements in a list  \n• Example  \nli=[1, 2, 3]  \n▪ li.insert(1, 3) o/p : [1, 3, 2,3] insertion of 3 at index 1  \n5. Append operation:  \n• Append also provide a means of altering a list  \n• Example:  \nli=[1, 2, 3]  \n▪ li.append(4) o/p : [1, 3, 2, 4] appending of 4 to end of list  \n6. Sort and reverse operation:  \n• methods sort() is used to arrange the elements in ascending order.  \n• Example:  \nli=[1, 3, 2]  \n▪ li.sort() o/p : [1,2,3] sort the list  \n7. Reverse operation:  \n• methods reverse() reorder the elements of a given list.  \n• Example:  \nli=[1, 3, 2]  \n▪ li.reverse() o/p : [2,3,1] reverse the element in the list  \n8.extend operation:  \n• The extend() method is used to add more than one element at the end of the list.  \n• Example:  \nli=[1, 2, 3]  \n▪ li.extend([4,5,6]) o/p : [1,2,3,4,5,6] extend the list  \n9.len operation:  \n• The len() method returns the length of the list, i.e. the number of elements in the list.  \n• Example:  \nli=[1, 2, 3]  \n▪ print(len(li)) o/p : 3 print length of the list  \n10.min and max operation:  \n• The min() method returns the minimum value in the list.  \n• The max() method returns the maximum value in the list. Both the methods accept only list having elements of similar type.  \n• Example:  \nli=[1, 2, 3]  \n▪ print(min(li)) o/p : 1 print minimum item of the list  \n▪ print(max(li)) o/p : 3 print maximum item of the list  \nExample :  \nli=['apple','orange','mango','banana'] print(type(li))  \n\\#print all item in a list print(li)  \n\\#print items in a list based on index start is 0 print(li[0","cbCaiomVn6Bvco0K","https://ap.wps.com/l/cbCaiomVn6Bvco0K","pdf",576149,"English","# 2.1 List\n## 2.1.1 List structures\n## 2.1.2 List Traversal\n## 2.1.3 Python List Type\n## 2.1.4 List Operations\n# 2.1.5 Tuples","[{\"question\":\"What is a Python list and how is indexing handled?\",\"answer\":\"A list is a mutable, linear data structure that allows variable length and mixed-type elements. List items use zero-based indexing, meaning the first element has index 0.\"},{\"question\":\"How can elements in a list be accessed and traversed?\",\"answer\":\"List traversal accesses elements one-by-one, usually starting from the first element and ending at the last. Elements can be accessed using their index value inside square brackets.\"},{\"question\":\"What makes tuples different from lists in Python?\",\"answer\":\"Tuples are immutable, so once created they cannot be altered. Delete, update, insert, and append operations defined for lists are not applicable to tuples.\"}]","UNIT 2 - Lists, Dictionaries And Sets | PDF",[144,148],{"page_no":22,"url":145,"width":146,"height":147},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/24b4de91b1f75360acfae0baabf35e58.webp",983,1272,{"page_no":26,"url":149,"width":150,"height":151},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/573ecf1f9a52805e1522873e1fddc557.webp",982,1270,{"list":153,"token":11},[154,160,166,172,179,185,191,197,203,209],{"doc_id":155,"doc_title":156,"file_type":137,"home_preview_img_url":157,"slug":158,"view_count":106,"category_name":29,"create_tm":159},685775,"Lists, Dictionaries and Tuples - Topic - 1","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000203838/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796168519&Signature=uVh0icI8jftF5eOp9hOecE7ahsw%3D","lists-dictionaries-and-tuples-topic-1",1794018224,{"doc_id":161,"doc_title":162,"file_type":137,"home_preview_img_url":163,"slug":164,"view_count":106,"category_name":29,"create_tm":165},685628,"Unit 2 - Chapter 6 - List Creation - List in Python","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000169819/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796168519&Signature=2%2Bpj9qLGkKOvvsVE34oIPWhjqik%3D","unit-2-chapter-6-list-creation-list-in-python",1794016091,{"doc_id":167,"doc_title":168,"file_type":137,"home_preview_img_url":169,"slug":170,"view_count":115,"category_name":29,"create_tm":171},685793,"1.4.2 Data Structures - Specification - 1.4.2","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000212437/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796168519&Signature=UB8ZOs8Dmym9jnW4t0DtDOGVnU8%3D","142-data-structures-specification-142",1794018669,{"doc_id":173,"doc_title":174,"file_type":137,"home_preview_img_url":175,"slug":176,"view_count":177,"category_name":29,"create_tm":178},461668,"Quiz 02-Practice - COMP 110 Practice Quiz - Spring 2024","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229926083182/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796168519&Signature=7KOE3mWcVFqej0F6BWsgyL83qUk%3D","quiz-02-practice-comp-110-practice-quiz-spring-2024",12,1790762100,{"doc_id":180,"doc_title":181,"file_type":137,"home_preview_img_url":182,"slug":183,"view_count":33,"category_name":29,"create_tm":184},718150,"MULTIPLE CHOICE QUESTIONS - B.Sc.Mathematics - Sixth Semester - MTS6 B14(E04): MATHEMATICAL PROGRAMMING WITH PYTHON AND LATEX","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230018609149/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796168519&Signature=y4810X18RYIgfKr8DlaPRh9mmJs%3D","multiple-choice-questions-bscmathematics-sixth-semester-mts6-b14e04-mathematical-programming-with-python-and-latex",1794854118,{"doc_id":186,"doc_title":187,"file_type":137,"home_preview_img_url":188,"slug":189,"view_count":106,"category_name":29,"create_tm":190},685781,"STUDENTS’ NOTE - ADVANCED PROGRAMMING I - FUNCTIONS AND ARRAYS/LISTS - Notes","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000208883/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796168519&Signature=N4Uw7N1WX0H6CxFy0R%2F2RxoLDd8%3D","students-note-advanced-programming-i-functions-and-arrayslists-notes",1794018466,{"doc_id":192,"doc_title":193,"file_type":137,"home_preview_img_url":194,"slug":195,"view_count":96,"category_name":29,"create_tm":196},697981,"ICDL Computing Lesson 8 - Aggregate Data Types","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230010146836/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796168519&Signature=lnqFB1H2ZxY0rOgRRIgBPWPyB10%3D","icdl-computing-lesson-8-aggregate-data-types",1794446564,{"doc_id":198,"doc_title":199,"file_type":137,"home_preview_img_url":200,"slug":201,"view_count":115,"category_name":29,"create_tm":202},417796,"PFTWeek - Python Basics - Variables, Types, and Operators","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229922495578/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796168519&Signature=hpwg5%2BWDzzCgyySucZtRVW%2FzMOM%3D","pftweek-python-basics-variables-types-and-operators",1790610654,{"doc_id":204,"doc_title":205,"file_type":137,"home_preview_img_url":206,"slug":207,"view_count":115,"category_name":29,"create_tm":208},476224,"Finding Range - Answer Key","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229926422138/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796168519&Signature=gfHaDMie02lZObkwQnBqa%2F%2FPGS8%3D","finding-range-answer-key-476224",1790787470,{"doc_id":210,"doc_title":211,"file_type":137,"home_preview_img_url":212,"slug":213,"view_count":214,"category_name":29,"create_tm":215},311483,"AP Computer Science Principles - Appendix 2 - Exam Reference Sheet","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229907585102/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796168519&Signature=dxo2pfeMjsBRwbOpMn9zJshg18o%3D","ap-computer-science-principles-appendix-2-exam-reference-sheet",14,1789894352]