[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-seo-697981-105":3,"detail-sidebar-cat-0-en-105":81,"doc-detail-697981-en":130,"doc-similar-697981":161},{"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","icdl-computing-lesson-8-aggregate-data-types","ICDL Computing Lesson 8 - Aggregate Data Types","","Lesson 8 focuses on Python aggregate data types, explaining how list and tuple can store multiple elements such as names, numbers, or related values. The material contrasts mutable lists with immutable tuples, then demonstrates practical operations including sorting a list, retrieving elements by index, and accessing tuple values. Review exercises test understanding of which data type fits given values and how tuples and lists differ in behavior.",{"@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/icdl-computing-lesson-8-aggregate-data-types/697981/",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/icdl-computing-lesson-8-aggregate-data-types/697981.png","ImageObject",300,407,{"name":42,"@type":43},"Levi","Person",{"url":19,"name":45,"@type":46},"DocShare","Organization","application/pdf","2026-11-22","2026-11-12",true,{"@type":52,"interactionType":53,"userInteractionCount":55},"InteractionCounter",{"@type":54},"ViewAction",5,{"@type":57,"mainEntity":58},"FAQPage",[59,65,69],{"name":60,"@type":61,"acceptedAnswer":62},"What are aggregate data types in Python?","Question",{"text":63,"@type":64},"Aggregate data types hold multiple items in a single variable. In Python, two key aggregate types are list and tuple.","Answer",{"name":66,"@type":61,"acceptedAnswer":67},"How do lists and tuples differ in Python?",{"text":68,"@type":64},"Lists can be changed by adding, removing, or modifying items, while tuples cannot be rearranged or modified once created.",{"name":70,"@type":61,"acceptedAnswer":71},"How can you access elements inside a list or tuple?",{"text":72,"@type":64},"Select an element by using the variable name followed by its index in square brackets, with indexing starting from zero.","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},697981,1794446564,{"code":4,"msg":82,"data":83},"success",[84,88,92,95,99,104,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":55,"doc_module":4,"doc_module_name":25,"category_name":96,"show_sort_weight":97,"slug":98},"Comic",60,"comic",{"id":100,"doc_module":4,"doc_module_name":25,"category_name":101,"show_sort_weight":102,"slug":103},6,"Technology",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":55,"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":105,"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":143,"preview_page_count":33,"preview_urls":144},7971461740909,"https://ap-avatar.wpscdn.com/davatar_155a257f0dc6eb9ab79c44ca47cae57d","LESSON 8 –  \nAGGREGATE DATA TYPES  \nAfter completing this lesson, you should be able to:  \n􀁸 Understand aggregate data types  \n􀁸 Use aggregate data in a program like: list and tuple  \n8.1 AGGREGATE DATA TYPES IN PYTHON  \n Concepts  \nAs well as standard data types such as int, string and Boolean, there is another category of data type called aggregate data types. Aggregate data types hold multiple items, for example, a list of names. Most programming languages deal with aggregate data types in some way for example, an array contains a group of elements of the same data type.  \nTwo Python aggregate data types are list and tuple.  \nList  \nA collection of values. Lists can change by adding items to or removing items from them or changing an item in a list. Python can display an entire list of values. It can also retrieve items from a list. (The Python ‘list’ aggregate data type fulfils the role of an ‘array’ in other programming languages. )  \nTuple  \nA tuple is just like a list, except once it has been created it can’t be changed by rearranging, adding or removing items or modifying individual items.  \nWhile the restriction on tuples might appear to make them less useful than lists, tuples have two important advantages:  \n1. Retrieving items from Tuples is faster than retrieving items from lists.  \n2. A programmer reading code for tuples will not need to check if values were changed.  \nThe items in a list or tuple are called elements.  \nAn element in a list or tuple can be selected by giving the name of the list or tuple and then the number of the element in square brackets. For example, element 3 of the list called pets is:  \npets[3]  \nElements are referenced by numbers starting from zero, so in the list:  \n[“cat”,“dog”,“hamster”,“goldfish”,“rabbit”,“turtle”]  \npets[0] = cat  \npets[1] = dog  \npets[3] = goldfish  \n8.2 LISTS  \n Concepts  \nPython has some built-in methods for working with lists. For example, this command will sort the list called pets:  \npets.sort()  \nExample: Working with Lists  \n1. Open Python.  \n2. Create a list called pets, by enclosing the elements in square brackets, as you see in the screenshot below.  \n3. Explore individual elements of the list by using numbers in square brackets as shown.  \nExample: Sorting a List in Python  \n1. Open Python.  \n2. Create a program file [called ManyNames.py](called ManyNames.py).  \n3. Type in the program code as below, using the names of some friends if you like, rather than the names given here.  \n4. Run the program.  \nICDL Computing Lesson 8 – Aggregate Data Types  \n8.3 TUPLES  \n Concepts  \nTuples in Python  \nTuples are created in the same way as lists, but using round brackets instead of square brackets.  \nYou cannot sort a tuple with the sort() command, as Python does not allow rearrangement of a tuple’s elements.  \nIf a variable is assigned to a tuple, Python still can’t make changes to that tuple. Python can however assign a new variable to the tuple i.e. replace the tuple with anew one. This sequence shows an example of how you might replace one tuple with a new one:  \nanimal_tuple = (‘cat’,’dog’,’pig’)  \nanimal_tuple = (‘elephant’, ‘tiger’,‘giraffe’)  \nThe second tuple replaces the first.  \nOne common use for a tuple is to hold the x and y position of a point on the screen. Instead of having two variables, one for x, and one for y, a single tuple variable can hold both values. When the x and y values are needed, they can be extracted from the tuple.  \n(A list could be used in the same way as a tuple to hold the x and y position of a point on the screen but a tuple is more efficient. )  \nExample: Attempting to Sort a Tuple:  \n1. Open Python.  \n2. Use the code shown below to create a tuple containing names of fruit.  \n3. Show the tuple's value by typing 'fruit'.  \n4. Attempt to sort the tuple.  \nICDL Computing Lesson 8 – Aggregate Data Types  \nExample: Extracting x and y from a Tuple  \n1. Open Python.  \n2. Use the code shown to create a tuple containing 40 and 150.  \n3","cbCaiuJZumk4k6Ks","https://ap.wps.com/l/cbCaiuJZumk4k6Ks","pdf",81550,"English","# 8.1 Aggregate Data Types in Python\n## Concepts\n# 8.2 Lists\n## Concepts\n# 8.3 Tuples\n## Concepts\n# 8.4 Review Exercise","[{\"question\":\"What are aggregate data types in Python?\",\"answer\":\"Aggregate data types hold multiple items in a single variable. In Python, two key aggregate types are list and tuple.\"},{\"question\":\"How do lists and tuples differ in Python?\",\"answer\":\"Lists can be changed by adding, removing, or modifying items, while tuples cannot be rearranged or modified once created.\"},{\"question\":\"How can you access elements inside a list or tuple?\",\"answer\":\"Select an element by using the variable name followed by its index in square brackets, with indexing starting from zero.\"}]","ICDL Computing Lesson 8 - Aggregate Data Types | PDF",18,[145,149,153,157],{"page_no":22,"url":146,"width":147,"height":148},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-12/cc21f10ad222da976f8a0410d3fca251.webp",983,1390,{"page_no":26,"url":150,"width":151,"height":152},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-12/45e538fc55140db8e7d87c59b3201791.webp",982,1388,{"page_no":30,"url":154,"width":155,"height":156},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-12/7fdaffef48b75cb2b803cc5ffa85f995.webp",981,1387,{"page_no":33,"url":158,"width":159,"height":160},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-12/93d3c7f5c43ddb00554ab7abae70f571.webp",980,1385,{"list":162,"token":11},[163,170,176,182,188,194,200,206,212,219],{"doc_id":164,"doc_title":165,"file_type":137,"home_preview_img_url":166,"slug":167,"view_count":168,"category_name":29,"create_tm":169},391904,"Deloitte Python Interview Questions - Basic Python Questions","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229917409659/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796168519&Signature=lU6QKTskuhzQHwpbr4aYjgF7a8Y%3D","deloitte-python-interview-questions-basic-python-questions",14,1790359985,{"doc_id":171,"doc_title":172,"file_type":137,"home_preview_img_url":173,"slug":174,"view_count":105,"category_name":29,"create_tm":175},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":177,"doc_title":178,"file_type":137,"home_preview_img_url":179,"slug":180,"view_count":115,"category_name":29,"create_tm":181},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":183,"doc_title":184,"file_type":137,"home_preview_img_url":185,"slug":186,"view_count":110,"category_name":29,"create_tm":187},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=1796168519&Signature=wR%2BHOAW%2FcBN8s76wThYI0PZbr74%3D","unit-2-lists-dictionaries-and-sets",1794018222,{"doc_id":189,"doc_title":190,"file_type":137,"home_preview_img_url":191,"slug":192,"view_count":30,"category_name":29,"create_tm":193},727274,"Data Structures Using Python - (R20A0503) Lecture Notes - B.TECH II Year I-Sem (R20)","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230029071315/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796168519&Signature=OfZsbs6wUjqsUuEw7ec6yR75uao%3D","data-structures-using-python-r20a0503-lecture-notes-btech-ii-year-i-sem-r20",1795232719,{"doc_id":195,"doc_title":196,"file_type":137,"home_preview_img_url":197,"slug":198,"view_count":105,"category_name":29,"create_tm":199},697967,"Data Structures Using Python - Course Syllabus - Lecture Notes","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230010146279/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796168519&Signature=m03bERvdpAnZ6ctyhjKv%2BFbBVOE%3D","data-structures-using-python-course-syllabus-lecture-notes",1794446538,{"doc_id":201,"doc_title":202,"file_type":137,"home_preview_img_url":203,"slug":204,"view_count":123,"category_name":29,"create_tm":205},391744,"Python Important Interview Questions","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229917704032/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796168519&Signature=WR%2Bidj1UFGH9LN86G9FuXEgfIoc%3D","python-important-interview-questions",1790358218,{"doc_id":207,"doc_title":208,"file_type":137,"home_preview_img_url":209,"slug":210,"view_count":33,"category_name":29,"create_tm":211},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":213,"doc_title":214,"file_type":137,"home_preview_img_url":215,"slug":216,"view_count":217,"category_name":29,"create_tm":218},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":220,"doc_title":221,"file_type":137,"home_preview_img_url":222,"slug":223,"view_count":224,"category_name":29,"create_tm":225},205844,"Victorian Tertiary Admissions Centre 2024 Aggregate to ATAR Table - Table for ATAR by scaled aggregate range","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229883384263/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796168519&Signature=BIXiSMW9Y2uHv9sC6wxoQjA2PjU%3D","victorian-tertiary-admissions-centre-2024-aggregate-to-atar-table-table-for-atar-by-scaled-aggregate-range",15,1788584790]