[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-seo-685628-105":3,"detail-sidebar-cat-0-en-105":81,"doc-detail-685628-en":130,"doc-similar-685628":165},{"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-chapter-6-list-creation-list-in-python","Unit 2 - Chapter 6 - List Creation - List in Python","","Unit 2 Chapter 6 explains list creation in Python, defining lists as collections enclosed in square brackets with comma-separated items. It provides the core syntax for assigning lists to a variable and demonstrates printing empty and populated lists. The material then covers key list operators—concatenation, repetition, slicing, range slicing, membership (in/not in)—along with example outputs. Finally, it introduces list indexing (including negative indices) and demonstrates slicing behavior with colon notation, including step and reverse slicing.",{"@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-chapter-6-list-creation-list-in-python/685628/",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-chapter-6-list-creation-list-in-python/685628.png","ImageObject",300,407,{"name":42,"@type":43},"Aldword","Person",{"url":19,"name":45,"@type":46},"DocShare","Organization","application/pdf","2026-11-13","2026-11-07",true,{"@type":52,"interactionType":53,"userInteractionCount":55},"InteractionCounter",{"@type":54},"ViewAction",7,{"@type":57,"mainEntity":58},"FAQPage",[59,65,69],{"name":60,"@type":61,"acceptedAnswer":62},"How do you create a list in Python?","Question",{"text":63,"@type":64},"A list is defined as values separated by commas and enclosed in square brackets. Example: list_name = [item_1, item_2].","Answer",{"name":66,"@type":61,"acceptedAnswer":67},"What are the main list operators covered in this chapter?",{"text":68,"@type":64},"The chapter covers concatenation (+), repetition (*), slice access ([]) including range slicing ([:]), membership testing (in, not in).",{"name":70,"@type":61,"acceptedAnswer":71},"How does list indexing and slicing work, including negative indices?",{"text":72,"@type":64},"Indexing starts at 0 for the leftmost element. Negative indices count from the right (e.g., -1 is the last element). Slicing uses colon syntax, where the start is included and the stop is excluded, and step and reverse slicing are supported.","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},685628,1794016091,{"code":4,"msg":82,"data":83},"success",[84,88,92,95,100,105,109,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":55,"doc_module":4,"doc_module_name":25,"category_name":106,"show_sort_weight":107,"slug":108},"Healthcare",40,"healthcare",{"id":110,"doc_module":4,"doc_module_name":25,"category_name":111,"show_sort_weight":112,"slug":113},8,"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":139,"language":140,"language_code":8,"site_id":7,"html_lang":8,"table_of_contents":141,"faqs":142,"seo_title":143,"seo_description":12,"update_tm":80,"read_time":144,"preview_page_count":96,"preview_urls":145},2336478940917,"https://ap-avatar.wpscdn.com/davatar_6f874abed73319feea01a86fa6f0fab8","Unit 2 Chapter-6  \nList Creation  \nList in Python  \n• In python, a list can be defined as a collection of values or items.  \n• The items in the list are separated with the comma (,) and enclosed with the square brackets [ ] .  \nSyntax:  \nlist_name= [ item_ 1, item_ 2, item_ 3….item_n ]  \nExample: “[listdemo.py](listdemo.py)”  \nL1 = []  \nL2 = [123 , \"python\", 3 .7] L3 = [1 , 2 , 3 , 4 , 5 , 6] L4 = [\"C\" , \"Java\" , \"Python\"] print(L1)  \nprint(L2)  \nprint(L3)  \nprint(L4)  \nOutput:  \npython [listdemo.py](listdemo.py)  \n[]  \n[123 , 'python' , 3 .7][1 , 2 , 3 , 4 , 5 , 6][ 'C', 'Java' , 'Python' ]  \nList Operators  \nList Operators in Python  \n\n| + | It is known as concatenation operator used to concatenate two lists. |\n| --- | --- |\n| * | It is known as repetition operator. It concatenates the multiple copies of the same list. |\n| [] | It is known as slice operator. It is used to access the list item from list. |\n| [:] | It is known as range slice operator. It is used to access the range of list items from list. |\n| in | It is known as membership operator. It returns if a particular item is present in the specified list. |\n| not in | It is also a membership operator and It returns true if a particular list item is not present in the list. |\n\nList Operators in Python cont…  \nExample: “[listopdemo.py](listopdemo.py)”  \nnum=[1 , 2 , 3 ,4 , 5]  \nlang=[ 'python' , 'c' , 'java' , 'php ' ]  \nprint(num + lang) \\#concatenates two lists  \nprint(num * 2) \\#concatenates same list 2 times print (lang[2]) \\# prints 2nd index value print (lang[1:4]) \\#prints values from 1st to 3rd index. print ( 'cpp ' in lang) \\# prints False  \nprint (6 not in num) \\# prints True  \nOutput: python listopdemo.py  \n[1 , 2 , 3 , 4 , 5 , 'python' , 'c', 'java' , 'php ' ][1 , 2 , 3 , 4 , 5 , 1 , 2 , 3 , 4 , 5]  \njava  \n[ 'c', 'java' , 'php ' ]  \nFalse  \nTrue  \nList Indexing  \nList Indexing in Python  \n• Like string sequence, the indexing of the python lists starts from 0, i.e. the first element of the list is stored at the 0th index, the second element of the list is stored at the 1st index, and so on.  \n• The elements of the list can be accessed by using the slice operator [] .  \n• The syntax for accessing an item in a list is,  \n• list name[index] Example:  \nmylist=[‘banana’,’apple’,’mango’,’tomato’,’berry’]  \n• mylist[0]=”banana” mylist[1:3]=[”apple”,”mango”]  \n• mylist[2]=”mango”  \nList Indexing in Python cont…  \n• Unlike other languages, python provides us the flexibility to use the negative indexing also. The negative indices are counted from the right.  \n• The last element (right most) of the list has the index -1, its adjacent left element is present at the index-2 and so on until the left most element is encountered.  \nExample: mylist=[‘banana’,’apple’,’mango’,’tomato’,’berry’]  \n• mylist[-1]=”berry” mylist[-4:-2]=[“apple”,”mango”]  \n• mylist[-3]=”mango” mylist [ -3 : ]=[“mango”,”tomato”,’berry’]  \nSlicing in list  \n• Slicing of lists is allowed in Python wherein a part of the list can be extracted by  \n• specifying index range along with the colon (:) operator which itself is a list.  \n• The syntax for list slicing is,•  \n• List slicing returns a part of the list from the start index value to stop index value which includes the start index value but excludes the stop index value. Step specifies the increment value to slice by and it is optional. By default the step value is  \n• 1. >>> fruits = [\"grapefruit\", \"pineapple\", \"blueberries\", \"mango\",\"banana\"]  \n• 2. >>> fruits[1:3]  \n• ['pineapple', 'blueberries']  \n• 3. >>> fruits[:3]  \n• ['grapefruit', 'pineapple', 'blueberries']  \n• 4. >>> fruits[2:]  \n• ['blueberries', 'mango', 'banana']  \n• 5. >>> fruits[1:4:2]  \n• ['pineapple', 'mango']  \n• 6. >>> fruits[:]  \n• ['grapefruit', 'pineapple', 'blueberries', 'mango', 'banana']  \n• 7. >>> fruits[::2]  \n• ['grapefruit', 'blueberries', 'banana']  \n• 8. >>> fruits[::-1]  \n• ['banana', 'mango', 'blueberries', 'pineapple', 'grapefruit']  \n• 9. >>> fruits[-3:-1]  \n• ['bl","cbCaidwnEvh0UvaM","https://ap.wps.com/l/cbCaidwnEvh0UvaM","pdf",501733,43,"English","# Unit 2 Chapter 6\n## List Creation\n## List Operators in Python\n## List Indexing in Python\n## Slicing in list","[{\"question\":\"How do you create a list in Python?\",\"answer\":\"A list is defined as values separated by commas and enclosed in square brackets. Example: list_name = [item_1, item_2].\"},{\"question\":\"What are the main list operators covered in this chapter?\",\"answer\":\"The chapter covers concatenation (+), repetition (*), slice access ([]) including range slicing ([:]), membership testing (in, not in).\"},{\"question\":\"How does list indexing and slicing work, including negative indices?\",\"answer\":\"Indexing starts at 0 for the leftmost element. Negative indices count from the right (e.g., -1 is the last element). Slicing uses colon syntax, where the start is included and the stop is excluded, and step and reverse slicing are supported.\"}]","Unit 2 - Chapter 6 - List Creation - List in Python | PDF",108,[146,150,154,158,162],{"page_no":22,"url":147,"width":148,"height":149},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/0901886cc682622e457f5199ac7793df.webp",983,737,{"page_no":26,"url":151,"width":152,"height":153},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/80bb89287743a64b7a1f7916a3f1cc76.webp",982,736,{"page_no":30,"url":155,"width":156,"height":157},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/0d1d38c3ff006d303edfe79afbea1892.webp",981,735,{"page_no":33,"url":159,"width":160,"height":161},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/f1462a28d407d1d5b279be3b91de2a72.webp",980,734,{"page_no":96,"url":163,"width":164,"height":161},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/413f49950612fca3586a15c5d4f39a5a.webp",979,{"list":166,"token":11},[167,173,179,185,191,198,204,210,216,222],{"doc_id":168,"doc_title":169,"file_type":137,"home_preview_img_url":170,"slug":171,"view_count":110,"category_name":29,"create_tm":172},685774,"UNIT 2 - Lists, Dictionaries And Sets","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000203839/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796169239&Signature=3%2FE9mz0ZLPAwEm3%2B1%2F4xlkIX9TM%3D","unit-2-lists-dictionaries-and-sets",1794018222,{"doc_id":174,"doc_title":175,"file_type":137,"home_preview_img_url":176,"slug":177,"view_count":33,"category_name":29,"create_tm":178},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=1796169239&Signature=CnPRrgSaElPujBthWuQauYDjPmE%3D","multiple-choice-questions-bscmathematics-sixth-semester-mts6-b14e04-mathematical-programming-with-python-and-latex",1794854118,{"doc_id":180,"doc_title":181,"file_type":137,"home_preview_img_url":182,"slug":183,"view_count":55,"category_name":29,"create_tm":184},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=1796169239&Signature=WF8RAZhXaCfC8Pyt4SZa35Qq6vA%3D","lists-dictionaries-and-tuples-topic-1",1794018224,{"doc_id":186,"doc_title":187,"file_type":137,"home_preview_img_url":188,"slug":189,"view_count":115,"category_name":29,"create_tm":190},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=1796169239&Signature=mZxvIUdBHLNzU7DGF8MBBOks%2B98%3D","pftweek-python-basics-variables-types-and-operators",1790610654,{"doc_id":192,"doc_title":193,"file_type":137,"home_preview_img_url":194,"slug":195,"view_count":196,"category_name":29,"create_tm":197},391172,"Infosys-Python-Interview-Questions - Interview Questions - Python","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229917366635/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796169239&Signature=6bkdre90ZIYAhzdJIFSuHlCK%2Bqk%3D","infosys-python-interview-questions-interview-questions-python",17,1790349846,{"doc_id":199,"doc_title":200,"file_type":137,"home_preview_img_url":201,"slug":202,"view_count":26,"category_name":29,"create_tm":203},728611,"W4 Exam - JamCoders Week 4 Exam July 30, 2026","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230030203011/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796169239&Signature=TWM8rhKFnZeyR8TPxidF%2BiKR8p8%3D","w4-exam-jamcoders-week-4-exam-july-30-2026",1795292664,{"doc_id":205,"doc_title":206,"file_type":137,"home_preview_img_url":207,"slug":208,"view_count":196,"category_name":29,"create_tm":209},391580,"Python coding interview questions for data analyst","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229917692249/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796169239&Signature=v7xFoBgoFnkxaI77S6nfQnZt1lU%3D","python-coding-interview-questions-for-data-analyst",1790355255,{"doc_id":211,"doc_title":212,"file_type":137,"home_preview_img_url":213,"slug":214,"view_count":96,"category_name":29,"create_tm":215},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=1796169239&Signature=I2t2NguIwubTtPfP5fGFsFsiyoU%3D","icdl-computing-lesson-8-aggregate-data-types",1794446564,{"doc_id":217,"doc_title":218,"file_type":137,"home_preview_img_url":219,"slug":220,"view_count":55,"category_name":29,"create_tm":221},483129,"Inserting Commas - Answer Key - Practice 1-20","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229926463280/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796169239&Signature=lr%2B1SO9bdInAdt4adxhmkbv3mEw%3D","inserting-commas-answer-key-practice-1-20",1790800005,{"doc_id":223,"doc_title":224,"file_type":137,"home_preview_img_url":225,"slug":226,"view_count":227,"category_name":29,"create_tm":228},464795,"Four Digit plus Four Digit Addition - Solve each problem","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229926204650/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796169239&Signature=cFxHRJs2w8U1WmfihkOX1Kpbgns%3D","four-digit-plus-four-digit-addition-solve-each-problem",11,1790768670]