[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-seo-685777-105":3,"detail-sidebar-cat-0-en-105":80,"doc-detail-685777-en":130,"doc-similar-685777":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":73,"head_meta":75,"extra_data":77,"updated_unix":79},105,"en","lists-and-tuples-learn-to-create-and-use-1d-lists-tuples-and-2d-lists","Lists and Tuples - Learn to create and use 1D lists, tuples and 2D lists","","This lesson explains how lists and tuples store data in SPIKE 3 software, focusing on 1D lists and tuples as ordered collections with index positions starting at 0. It introduces list syntax and tuple syntax, demonstrates accessing items by index, and covers key list methods such as append, extend, insert, remove, pop, reverse, and sort. It also contrasts mutable lists with immutable tuples and strings, then teaches copying lists using the copy module. Further sections cover slicing, length, sum, and for-loops over lists, plus converting strings to lists via list() and split().",{"@graph":14,"@context":72},[15,34,55],{"@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/technology/","Technology",3,{"item":32,"name":10,"@type":21,"position":33},"https://docshare.wps.com/document/lists-and-tuples-learn-to-create-and-use-1d-lists-tuples-and-2d-lists/685777/",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/lists-and-tuples-learn-to-create-and-use-1d-lists-tuples-and-2d-lists/685777.png","ImageObject",300,407,{"name":42,"@type":43},"Fahsai","Person",{"url":19,"name":45,"@type":46},"DocShare","Organization","application/pdf","2026-11-10","2026-11-07",true,{"@type":52,"interactionType":53,"userInteractionCount":30},"InteractionCounter",{"@type":54},"ViewAction",{"@type":56,"mainEntity":57},"FAQPage",[58,64,68],{"name":59,"@type":60,"acceptedAnswer":61},"What are lists and tuples used for in this lesson?","Question",{"text":62,"@type":63},"Lists and tuples store a set of data. Lists are shown using square brackets, while tuples use parentheses.","Answer",{"name":65,"@type":60,"acceptedAnswer":66},"How do you access data inside a list or tuple?",{"text":67,"@type":63},"Each entry has an index starting at 0, and data is accessed with index notation like L[index].",{"name":69,"@type":60,"acceptedAnswer":70},"Why are lists mutable while tuples and strings are not?",{"text":71,"@type":63},"Lists can be edited by changing an element at an index, which updates the same memory object. Tuples and strings do not support item assignment, so edits require creating new values.","https://schema.org",{"og:url":32,"og:type":74,"og:title":10,"og:site_name":45,"og:description":12},"article",{"robots":76,"canonical":32},"index,follow",{"doc_id":78,"site_id":7},685777,1794018226,{"code":4,"msg":81,"data":82},"success",[83,87,91,95,100,104,109,114,119,122,126],{"id":22,"doc_module":4,"doc_module_name":25,"category_name":84,"show_sort_weight":85,"slug":86},"Story & Novel",90,"story-novel",{"id":26,"doc_module":4,"doc_module_name":25,"category_name":88,"show_sort_weight":89,"slug":90},"Literature",80,"literature",{"id":33,"doc_module":4,"doc_module_name":25,"category_name":92,"show_sort_weight":93,"slug":94},"Exam",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":29,"show_sort_weight":102,"slug":103},6,50,"technology",{"id":105,"doc_module":4,"doc_module_name":25,"category_name":106,"show_sort_weight":107,"slug":108},7,"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":81,"data":131},{"doc_id":78,"user_id":132,"nickname":42,"user_avatar":133,"doc_module":4,"category_id":101,"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":30,"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":79,"read_time":102,"preview_page_count":26,"preview_urls":143},549768702563,"https://ap-avatar.wpscdn.com/avatar/8000c4aa63b76e948b?x-image-process=image/resize,m_fixed,w_180,h_180&k=1786536092046926083","PRIME LESSONS  \nBy the Makers of EV3Lessons  \nLISTS AND TUPLES  \nBY SANJAY ANDARVIND SESHAN  \nThis lesson uses SPIKE 3 software  \nLESSON OBJECTIVES  \n¢ Learn to create and use 1D lists  \n¢ Learn to create and use tuples  \n¢ Learn to create and use 2D lists  \nBASICS  \n¢ Lists and Tuples store a set of data  \n¢ Comma separated lists  \n¢ Lists inside brackets  \n¢ Tuples inside parentheses  \n¢ Each entry in a list or tuple is assigned an index, starting at 0  \n¢ L=[index 0, index 1, index 2…..]  \n¢ You can read data at an index (for lists, tuples, and strings) by calling  \n¢ L[index]  \n\\# List:  \nL = [ 1 , 2 , 3]  \nM = [ \"Hello\" , \"bye\"] N = [ 1 , True , \"Hello\"] L[0] == 1 \\# True  \n\\# Tuple:  \na = (1 , 2 , 3)  \nb = ( \"Hello\" , \"bye\") c = (1 , True , \"Hello\")  \nLIST METHODS  \n¢ All list methods edit the original list and do not return anything (except pop() which returns the removed data)  \n\n| Method | Description |\n| --- | --- |\n| append(data) | Adds an element at the end of the list |\n| count(data) | Returns the number of elements with the specified value |\n| extend(L) | Add the elements of a list (or any iterable), to the end of the current list |\n| index(data) | Returns the index of the first element with the specified value |\n| insert(i, data) | Adds an element at the specified position |\n| pop(i) | Removes the element at the specified position |\n| remove(data) | Removes the first item with the specified value |\n| reverse() | Reverses the order of the list |\n| sort() | Sorts the list |\n\nMUTABILITY  \n¢ Lists are a mutable data type  \n¢ Tuples, strings, etc. are not  \n¢ This means that when you edit a list, it edits that same memory (RAM) object instead of creating a new one  \n¢ You can edit a List by assigning an index’s data to a new piece of data (see yellow)  \n¢ This is not true for strings or tuples  \n>>> s = \"abc\"  \n>>> s[0] = \"b\"  \nTypeError: 'str' object does not support item assignment >>> t = (1,2,3)  \n>>> t[1] = 0  \nTypeError: 'tuple' object does not support item assignment >>> L = [1,2,3]  \n>>> L[0] = 4 >>> L  \n [4, 2, 3]  \n>>>  \nCOPYING A LIST  \n¢ You must use the copy function from the copy module  \n¢ Unlike strings, tuples, etc ., the memory object must be copied; other types will be “copied” simply by “changing”the value  \n¢ [I.e. you](I.e. you) cannot do a=b to copy a list, but you can for other types → see this in action in the right (green)  \n¢ You can copy a list (see yellow)  \n¢ M = L.copy ()  \n¢ Edits do not affect the original list  \n>>> L = [1,2,3]  \n>>> M=L  \n>>> print(M, L)[1, 2, 3] [1, 2, 3]>>> L .append(5)  \n>>> print(M, L)[1, 2, 3, 5] [1, 2, 3, 5]  \n>>> N = L .copy()  \n>>> N .append(4)  \n>>> print(M, L, N)[1, 2, 3, 5] [1, 2, 3, 5] [1, 2, 3, 5, 4]  \nMORE ABOUT LISTS  \n¢ You can….  \n¢ Get slices (sections)  \n¢ Length of list  \n¢ Sum of list  \n¢ Append, etc. (see list methods)  \n¢ Sort a list using .sort() (numerically, alphabetically, etc.) method  \n¢ Reverse a list using .reverse() method  \nL = [ 1 , 2 , 3 , 4 , 5]  \n\\# Slices  \nL[ 1 : 3] == [2 , 3] L[ 1 : 5 :2] == [2 , 4]  \n\\# L[START:END:INTERVAL]  \n\\# Length (of list/tuple)  \nlen(L) == 5  \n\\# Sum (of all items in the list/tuple)  \nsum(L) == 15  \n\\# Add to list  \nL.append(6)  \nprint(L) \\# [1, 2, 3, 4, 5, 6]  \nFOR LOOPS WITH LISTS  \n¢ You can iterate (i.e. sequentially go through) through a list or tuple using a “for” loop  \n¢ The loop variable (“item” in the example) is assigned the value of the next item in the list each time through the loop  \n¢ The loop ends when there are no more items  \nL = [ 1 , 2 , 8 , \"hello\"] for item in L:  \nprint(item)  \nOutput: 1  \n2  \n8  \nhello  \nSTRINGS TO LISTS  \n¢ You can use the list() function to split each character into an entry  \n¢ You can also use the split() method to convert the string into a list, splitting at the desired item  \n¢ You can undo the conversion with \"\".join(L)  \n>>> L = list(\"abcd\")>>> print(L)  \n[ 'a' , 'b' , 'c' , 'd' ]>>> s = \"a,b,c,de\"  \n>>> M = s .split(\",\")>>> print(M)  \n[ 'a' , 'b' , 'c","cbCairSffNcpZcCw","https://ap.wps.com/l/cbCairSffNcpZcCw","pdf",398373,"English","# Lesson Objectives\n## Basics of Lists and Tuples\n## List Methods\n## Mutability and Copying Lists\n## More About Lists (slices, len, sum)\n## For Loops with Lists\n## Strings to Lists\n## Challenge","[{\"question\":\"What are lists and tuples used for in this lesson?\",\"answer\":\"Lists and tuples store a set of data. Lists are shown using square brackets, while tuples use parentheses.\"},{\"question\":\"How do you access data inside a list or tuple?\",\"answer\":\"Each entry has an index starting at 0, and data is accessed with index notation like L[index].\"},{\"question\":\"Why are lists mutable while tuples and strings are not?\",\"answer\":\"Lists can be edited by changing an element at an index, which updates the same memory object. Tuples and strings do not support item assignment, so edits require creating new values.\"}]","Lists and Tuples - Learn to create and use 1D lists, tuples and 2D lists | PDF",[144,148],{"page_no":22,"url":145,"width":146,"height":147},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/fa58e04d3a1c573abe8e8e644289e75a.webp",983,737,{"page_no":26,"url":149,"width":150,"height":151},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/12a413c961517d07fd41a65c0a8885b5.webp",982,736,{"list":153,"token":11},[154,160,166,172,178,184,190,196,202,208],{"doc_id":155,"doc_title":156,"file_type":137,"home_preview_img_url":157,"slug":158,"view_count":30,"category_name":29,"create_tm":159},685772,"UNIT-IV - LIST, TUPLES, DICTIONARIES - Problem Solving and Python Programming","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000203776/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796181419&Signature=mfsaf7x%2FxcgP7SWR%2F4VUzSw4Yqw%3D","unit-iv-list-tuples-dictionaries-problem-solving-and-python-programming",1794018219,{"doc_id":161,"doc_title":162,"file_type":137,"home_preview_img_url":163,"slug":164,"view_count":101,"category_name":29,"create_tm":165},697978,"Lecture 4: Tuples, List Slicing, List Comprehension, Strings","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230010146771/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796181419&Signature=SL0ka1jYafjJfkf%2F2RokfAeJ90U%3D","lecture-4-tuples-list-slicing-list-comprehension-strings",1794446559,{"doc_id":167,"doc_title":168,"file_type":137,"home_preview_img_url":169,"slug":170,"view_count":96,"category_name":29,"create_tm":171},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=1796181419&Signature=uMQtvQyJyUzUPtmhdor4X01fSRk%3D","topic-6-lists-sets-tuples-dictionaries",1794018231,{"doc_id":173,"doc_title":174,"file_type":137,"home_preview_img_url":175,"slug":176,"view_count":33,"category_name":29,"create_tm":177},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=1796181419&Signature=i02BrY59AA9XpkkZnT41hvNgpmM%3D","tuple-in-python-lecture-2",1794018232,{"doc_id":179,"doc_title":180,"file_type":137,"home_preview_img_url":181,"slug":182,"view_count":33,"category_name":29,"create_tm":183},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=1796181419&Signature=UF4rk6Gb%2Fu0RIQS0K8BA6P7pcns%3D","tuples-and-dictionaries-introduction-to-tuples",1794446564,{"doc_id":185,"doc_title":186,"file_type":137,"home_preview_img_url":187,"slug":188,"view_count":96,"category_name":29,"create_tm":189},685778,"1-Tuples","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000203953/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796181419&Signature=%2FadSoZEoFezChus%2FLsdCTKVu%2BAs%3D","1-tuples",1794018230,{"doc_id":191,"doc_title":192,"file_type":137,"home_preview_img_url":193,"slug":194,"view_count":33,"category_name":29,"create_tm":195},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=1796181419&Signature=z7rxkqHtHm6Ax6q3mXiA4QdkFA4%3D","unit-iii-2-lists-tuples-dictionaries-41-lists-list-operations-and-methods",1794446558,{"doc_id":197,"doc_title":198,"file_type":137,"home_preview_img_url":199,"slug":200,"view_count":105,"category_name":29,"create_tm":201},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=1796181419&Signature=kn4x7E%2FgWxMoLP%2FGnic%2BAIKVinA%3D","60001-lecture-5-tuples-lists-aliasing-mutability-cloning",1794446554,{"doc_id":203,"doc_title":204,"file_type":137,"home_preview_img_url":205,"slug":206,"view_count":101,"category_name":29,"create_tm":207},685629,"Chapter 2: Lists, Arrays and Dictionaries","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229999084017/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796181419&Signature=OHrwcxwMvm2vWQPD1YZjMiLoI8M%3D","chapter-2-lists-arrays-and-dictionaries",1794016092,{"doc_id":209,"doc_title":210,"file_type":137,"home_preview_img_url":211,"slug":212,"view_count":105,"category_name":29,"create_tm":213},670917,"Python 3 Cheat Sheet - concise reference","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229988704071/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796181419&Signature=A3uCV%2BzH0Xk2XPI6zhUtrRLb6ms%3D","python-3-cheat-sheet-concise-reference",1793572698]