[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-0-en-105":3,"doc-seo-685631-105":59,"doc-detail-685631-en":130,"doc-similar-685631":154},{"code":4,"msg":5,"data":6},0,"success",[7,13,18,23,28,33,38,43,48,51,55],{"id":8,"doc_module":4,"doc_module_name":9,"category_name":10,"show_sort_weight":11,"slug":12},1,"Document","Story & Novel",90,"story-novel",{"id":14,"doc_module":4,"doc_module_name":9,"category_name":15,"show_sort_weight":16,"slug":17},2,"Literature",80,"literature",{"id":19,"doc_module":4,"doc_module_name":9,"category_name":20,"show_sort_weight":21,"slug":22},4,"Exam",70,"exam",{"id":24,"doc_module":4,"doc_module_name":9,"category_name":25,"show_sort_weight":26,"slug":27},5,"Comic",60,"comic",{"id":29,"doc_module":4,"doc_module_name":9,"category_name":30,"show_sort_weight":31,"slug":32},6,"Technology",50,"technology",{"id":34,"doc_module":4,"doc_module_name":9,"category_name":35,"show_sort_weight":36,"slug":37},7,"Healthcare",40,"healthcare",{"id":39,"doc_module":4,"doc_module_name":9,"category_name":40,"show_sort_weight":41,"slug":42},8,"Research & Report",30,"research-report",{"id":44,"doc_module":4,"doc_module_name":9,"category_name":45,"show_sort_weight":46,"slug":47},9,"Religion & Spirituality",20,"religion-spirituality",{"id":46,"doc_module":4,"doc_module_name":9,"category_name":49,"show_sort_weight":46,"slug":50},"World Cup","world-cup",{"id":52,"doc_module":4,"doc_module_name":9,"category_name":53,"show_sort_weight":52,"slug":54},10,"Lifestyle","lifestyle",{"id":56,"doc_module":4,"doc_module_name":9,"category_name":57,"show_sort_weight":24,"slug":58},19,"General","general",{"code":4,"msg":60,"data":61},"ok",{"site_id":62,"language":63,"slug":64,"title":65,"keywords":66,"description":67,"schema_data":68,"social_meta":123,"head_meta":125,"extra_data":127,"updated_unix":129},105,"en","introduction-to-list-list-operations-traversing-a-list-list-methods-and-built-in-functions","Introduction to List - List Operations - Traversing a List - List Methods and Built-in Functions","","Covers Python’s list data type as an ordered, mutable sequence of elements that can contain mixed data types, including nested lists. Explains how lists are represented with square brackets and comma separation, and how indexing starts from 0. Provides guidance on accessing elements, handling index errors, and using positive and negative indices. Details list operations such as concatenation, repetition, membership tests, and slicing, including steps and reverse slicing. Introduces traversal using for and while loops, plus built-in methods and functions for list manipulation.",{"@graph":69,"@context":122},[70,84,105],{"@type":71,"itemListElement":72},"BreadcrumbList",[73,77,79,82],{"item":74,"name":75,"@type":76,"position":8},"https://docshare.wps.com","Home","ListItem",{"item":78,"name":9,"@type":76,"position":14},"https://docshare.wps.com/document/",{"item":80,"name":30,"@type":76,"position":81},"https://docshare.wps.com/document/technology/",3,{"item":83,"name":65,"@type":76,"position":19},"https://docshare.wps.com/document/introduction-to-list-list-operations-traversing-a-list-list-methods-and-built-in-functions/685631/",{"url":83,"name":65,"@type":85,"image":86,"author":91,"headline":65,"publisher":94,"fileFormat":97,"inLanguage":63,"description":67,"dateModified":98,"datePublished":99,"encodingFormat":97,"isAccessibleForFree":100,"interactionStatistic":101},"DigitalDocument",{"url":87,"@type":88,"width":89,"height":90},"https://docshare.wps.com/thumbnails/introduction-to-list-list-operations-traversing-a-list-list-methods-and-built-in-functions/685631.png","ImageObject",300,407,{"name":92,"@type":93},"Kurz","Person",{"url":74,"name":95,"@type":96},"DocShare","Organization","application/pdf","2026-11-22","2026-11-07",true,{"@type":102,"interactionType":103,"userInteractionCount":24},"InteractionCounter",{"@type":104},"ViewAction",{"@type":106,"mainEntity":107},"FAQPage",[108,114,118],{"name":109,"@type":110,"acceptedAnswer":111},"What makes Python lists different from strings?","Question",{"text":112,"@type":113},"Lists are ordered sequences that can hold elements of different data types, and they are mutable. Strings consist only of characters.","Answer",{"name":115,"@type":110,"acceptedAnswer":116},"How do you access list elements and what happens with invalid indexes?",{"text":117,"@type":113},"Use index notation like list1[0] or list1[-1], where indexes start from 0. Accessing an out-of-range index raises an IndexError.",{"name":119,"@type":110,"acceptedAnswer":120},"What list operations are covered, and how do concatenation and slicing differ?",{"text":121,"@type":113},"Concatenation joins two lists with the + operator, while slicing extracts a sublist using index ranges. Slicing supports steps and negative indices for reversed or stepped views.","https://schema.org",{"og:url":83,"og:type":124,"og:title":65,"og:site_name":95,"og:description":67},"article",{"robots":126,"canonical":83},"index,follow",{"doc_id":128,"site_id":62},685631,1794016095,{"code":4,"msg":5,"data":131},{"doc_id":128,"user_id":132,"nickname":92,"user_avatar":133,"doc_module":4,"category_id":29,"category_name":30,"doc_title":65,"doc_description":67,"doc_content":134,"file_id":135,"file_url":136,"file_type":137,"file_size":138,"view_count":24,"is_deleted":4,"is_public":8,"is_downloadable":8,"audit_status":8,"page_count":139,"language":140,"language_code":63,"site_id":62,"html_lang":63,"table_of_contents":141,"faqs":142,"seo_title":143,"seo_description":67,"update_tm":129,"read_time":144,"preview_page_count":14,"preview_urls":145},2336478945635,"https://ap-avatar.wpscdn.com/davatar_6f874abed73319feea01a86fa6f0fab8","# 9.1 INTRODUCTION TO LIST\n\nThe data type list is an ordered sequence which ismutable and made up of one or more elements.Unlikea string which consists of only characters,a list canhave elements of different data types,such as integer,float,string,tuple or even another list.A list is veryuseful to group together elements of mixed data types.Elements of a list are enclosed in square brackets andare separated by comma.Like string indices,list indicesalso start from 0.  \nExample 9.1  \n\\#list1 is the list of six even numbers>>>list1 =[2,4,6,8,10,12]>>>print(list1)  \n[2,4,6,8,10,12]  \n\\#list2 is the list of vowels>>>list2 =['a','e','i','o','u']>>>print(list2)  \n['a','e','i','o','u']  \n\\#list3 is the list of mixed data types>>>list3 =[100,23.5,'Hello']>>>print(list3)[100,23.5,'Hello']  \n\\#list4 is the list of lists called nested\\#list  \n>>>list4 =[['Physics',101],['Chemistry',202],['Maths',303]]>>>print(list4)  \n[['Physics',101],['Chemistry',202],['Maths',303]]  \n## 9.1.1 Accessing Elements in a List\n\nThe elements of a list are accessed in the same way ascharacters are accessed in a string.  \n11120CH09  \n\"Measuring programmingprogressby lines of codeis like measuring aircraftbuilding progress by weight.”  \n-BillGates  \nIn this chapter  \n》 Introduction to List  \n》 List Operations  \n》Traversing a List  \n》  List Methods andBuilt-in Functions  \n》  Nested Lists  \n》Copying Lists  \n》 List as Argumentsto Function  \n》List Manipulation  \n\\#initializes a list list1>>>list1 =[2,4,6,8,10,12]  \nNoTES  \n>>>list1[0]\\#return first element of list12  \n>>>list1[3]\\#return fourth element of list18  \n\\#return error as index is out of range>>>list1[15]  \nIndexError:list index out of range  \n\\#an expression resulting in an integer index>>>list1[1+4]12  \n>>>list1[-1]\\#return first element from right12  \n\\#length of the list list1 is assigned to n>>>n =len(list1)>>>print(n)6  \n\\#return the last element of the list1>>>list1[n-1]12  \n\\#return the first element of list1>>>list1[-n]2  \n## 9.1.2 Lists are Mutable\n\nIn Python,lists are mutable.It means that the contentsof the list can be changed after it has been created.  \n\\#List list1 of colors  \n>>>list1 =['Red','Green','Blue','Orange']\\#change/override the fourth element of list1>>>list1[3]='Black'>>>list1\\#print the modified list list1['Red','Green','Blue!,'Black']  \n# 9.2 LIST OPERATIONS\n\nThe data type list allows manipulation of its contentsthrough various operations as shown below.  \n## 9.2.1 Concatenation\n\nPython allows us to join two or more lists usingconcatenation operator depicted by the symbol+.  \n\\#list1 is list of first five odd integers>>>list1 =[1,3,5,7,9]  \n\\#list2 is list of first five even integers>>>list2 =[2,4,6,8,10]\\#elements of list1 followed by list2  \n>>>list1 +list2  \n[1,3,5,7,9,2,4,6,8,10]>>>list3 =['Red','Green','Blue!]>>>list4 =['Cyan','Magenta','Yellow,'Black']  \n>>>list3 +list4  \n['Red','Green','Blue','Cyan','Magenta','Yellow¹,'Black']  \nNote that,there is no change in ongoing lists,i.e.,list1,  list2,list3,  list4 remain the sameafter concatenation operation.If we want to merge twolists,then we should use an assignment statement toassign the merged list to another list.The concatenationoperator'+'requires that the operands should be of listtype only.If we try to concatenate a list with elements ofsome other data type,TypeError occurs.  \n>>>list1 =[1,2,3]>>>str1 =\"abc\">>>list1 +str1  \nTypeError:can only concatenate list(not\"str\")to list  \n## 9.2.2 Repetition\n\nPython allows us to replicate a list using repetitionoperator depicted by symbol*.  \n>>>list1 =['Hello']  \n\\#elements of list1 repeated 4 times>>>list1 *4['Hello','Hello','Hello','Hello']  \n## 9.2.3 Membership\n\nLike strings,the membership operators in checks ifthe element is present in the list and returns True,elsereturns False.  \n>>>list1 =['Red','Green','Blue']>>>'Green'in list1True  \n>>>'Cyan'in list1False  \nThe not in operator returns True if the element is notpresent in the list,else it returns False.  \n>>>list1 =['Red'","cbCailzUmRUFEhYL","https://ap.wps.com/l/cbCailzUmRUFEhYL","pdf",1925256,18,"English","# 9.1 Introduction to List\n## 9.1.1 Accessing Elements in a List\n## 9.1.2 Lists are Mutable\n# 9.2 List Operations\n## 9.2.1 Concatenation\n## 9.2.2 Repetition\n## 9.2.3 Membership\n## 9.2.4 Slicing\n# 9.3 Traversing a List\n## (A) List Traversal Using for Loop\n## (B) List Traversal Using while Loop\n# 9.4 List Methods and Built-in Functions","[{\"question\":\"What makes Python lists different from strings?\",\"answer\":\"Lists are ordered sequences that can hold elements of different data types, and they are mutable. Strings consist only of characters.\"},{\"question\":\"How do you access list elements and what happens with invalid indexes?\",\"answer\":\"Use index notation like list1[0] or list1[-1], where indexes start from 0. Accessing an out-of-range index raises an IndexError.\"},{\"question\":\"What list operations are covered, and how do concatenation and slicing differ?\",\"answer\":\"Concatenation joins two lists with the + operator, while slicing extracts a sublist using index ranges. Slicing supports steps and negative indices for reversed or stepped views.\"}]","Introduction to List - List Operations - Traversing a List - List Methods and Built-in Functions | PDF",45,[146,150],{"page_no":8,"url":147,"width":148,"height":149},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/410a1044446c644a301ea45764438e41.webp",983,1295,{"page_no":14,"url":151,"width":152,"height":153},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/fc3faec22d38ee7ace1c9ae785be4e0b.webp",982,1294,{"list":155,"token":66},[156,162,168,174,180,186,192,197,203,209],{"doc_id":157,"doc_title":158,"file_type":137,"home_preview_img_url":159,"slug":160,"view_count":34,"category_name":30,"create_tm":161},697976,"6.0001 Lecture 5 - Tuples, Lists, Aliasing, Mutability, Cloning","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230010146768/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796177459&Signature=iIWcIe1labB885E%2BYIOXCPvUqB0%3D","60001-lecture-5-tuples-lists-aliasing-mutability-cloning",1794446554,{"doc_id":163,"doc_title":164,"file_type":137,"home_preview_img_url":165,"slug":166,"view_count":19,"category_name":30,"create_tm":167},697977,"UNIT-III-2 - Lists, Tuples, Dictionaries - 4.1 Lists - List Operations and Methods","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230010146775/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796177459&Signature=QxCDKgNxnIvt8BQVo7kunLbSHPI%3D","unit-iii-2-lists-tuples-dictionaries-41-lists-list-operations-and-methods",1794446558,{"doc_id":169,"doc_title":170,"file_type":137,"home_preview_img_url":171,"slug":172,"view_count":19,"category_name":30,"create_tm":173},697980,"TUPLES AND DICTIONARIES - Introduction to Tuples","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230010146829/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796177459&Signature=%2BhrWIvKv5zwFOCR6%2BIBARrYh4CE%3D","tuples-and-dictionaries-introduction-to-tuples",1794446564,{"doc_id":175,"doc_title":176,"file_type":137,"home_preview_img_url":177,"slug":178,"view_count":19,"category_name":30,"create_tm":179},685780,"Tuple in Python - Lecture 2","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000203975/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796177459&Signature=z2cQniGRRX031KNzxzwfR6%2FTADE%3D","tuple-in-python-lecture-2",1794018232,{"doc_id":181,"doc_title":182,"file_type":137,"home_preview_img_url":183,"slug":184,"view_count":19,"category_name":30,"create_tm":185},685627,"List in Python - A Beginner Guide -","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000169755/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796177459&Signature=wS%2FluFAjkTxluyqdx%2FkwIRRJdHY%3D","list-in-python-a-beginner-guide",1794016087,{"doc_id":187,"doc_title":188,"file_type":137,"home_preview_img_url":189,"slug":190,"view_count":34,"category_name":30,"create_tm":191},685771,"Compound Data - Lists, Tuples, Dictionaries - Unit IV - Learning Notes","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000203726/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796177459&Signature=HPPfVtIUM8K%2FTP8n%2BSZUJzwtC4E%3D","compound-data-lists-tuples-dictionaries-unit-iv-learning-notes",1794018217,{"doc_id":193,"doc_title":194,"file_type":137,"home_preview_img_url":195,"slug":196,"view_count":19,"category_name":30,"create_tm":161},697975,"Python Variable Types - Variable Assignment, Multiple Assignment, and Standard Data Types","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230010146715/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796177459&Signature=5cH6uozsK28JZVQGT5QF6rfXeeE%3D","python-variable-types-variable-assignment-multiple-assignment-and-standard-data-types",{"doc_id":198,"doc_title":199,"file_type":137,"home_preview_img_url":200,"slug":201,"view_count":24,"category_name":30,"create_tm":202},671624,"Python Cheat Sheet - Complex Data Types","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229988737384/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796177459&Signature=cU1ci%2B30yLod0L9hILf4jBfjpt8%3D","python-cheat-sheet-complex-data-types",1793577649,{"doc_id":204,"doc_title":205,"file_type":137,"home_preview_img_url":206,"slug":207,"view_count":81,"category_name":30,"create_tm":208},685777,"Lists and Tuples - Learn to create and use 1D lists, tuples and 2D lists","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000203949/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796177459&Signature=qTT%2FH9fObxJ8M1Cqu%2Fpzjg1%2B%2Bqc%3D","lists-and-tuples-learn-to-create-and-use-1d-lists-tuples-and-2d-lists",1794018226,{"doc_id":210,"doc_title":211,"file_type":137,"home_preview_img_url":212,"slug":213,"view_count":24,"category_name":30,"create_tm":214},685779,"Topic 6 - Lists, Sets, Tuples, Dictionaries","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000203959/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796177459&Signature=LHu7nOsz%2F31POllRFAMHaCVsU1g%3D","topic-6-lists-sets-tuples-dictionaries",1794018231]