[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-0-en-105":3,"doc-seo-685781-105":59,"doc-detail-685781-en":130,"doc-similar-685781":149},{"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","students-note-advanced-programming-i-functions-and-arrayslists-notes","STUDENTS’ NOTE - ADVANCED PROGRAMMING I - FUNCTIONS AND ARRAYS/LISTS - Notes","","Students’ Note on Advanced Programming I explains how functions work and how they help structure programs. It covers function meaning, the importance of modular design, and the main components: name, parameters, function body, and return. The note then introduces arrays/lists, including list meaning, indexing starting from 0, creating lists, and common operations such as append, remove, length, sorting, and item access. It also shows how to loop through lists and combine functions with lists to compute totals.",{"@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":20,"@type":76,"position":81},"https://docshare.wps.com/document/exam/",3,{"item":83,"name":65,"@type":76,"position":19},"https://docshare.wps.com/document/students-note-advanced-programming-i-functions-and-arrayslists-notes/685781/",{"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/students-note-advanced-programming-i-functions-and-arrayslists-notes/685781.png","ImageObject",300,407,{"name":92,"@type":93},"Melati","Person",{"url":74,"name":95,"@type":96},"DocShare","Organization","application/pdf","2026-11-29","2026-11-07",true,{"@type":102,"interactionType":103,"userInteractionCount":34},"InteractionCounter",{"@type":104},"ViewAction",{"@type":106,"mainEntity":107},"FAQPage",[108,114,118],{"name":109,"@type":110,"acceptedAnswer":111},"What is a function and what does it do in a program?","Question",{"text":112,"@type":113},"A function is a named block of instructions designed to perform a particular task. It can take input data, process it, and may return a result.","Answer",{"name":115,"@type":110,"acceptedAnswer":116},"What are the main components of a function?",{"text":117,"@type":113},"A function commonly includes a function name, parameters, a function body, and a return statement to send results back to the caller.",{"name":119,"@type":110,"acceptedAnswer":120},"How do you access and modify items in a Python list?",{"text":121,"@type":113},"List indexing starts from 0, so you access an item using names[0] style syntax. To modify an item, assign a new value to a specific index, for example fruits[1] = \"Apple\".","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},685781,1794018466,{"code":4,"msg":5,"data":131},{"doc_id":128,"user_id":132,"nickname":92,"user_avatar":133,"doc_module":4,"category_id":19,"category_name":20,"doc_title":65,"doc_description":67,"doc_content":134,"file_id":135,"file_url":136,"file_type":137,"file_size":138,"view_count":34,"is_deleted":4,"is_public":8,"is_downloadable":8,"audit_status":8,"page_count":29,"language":139,"language_code":63,"site_id":62,"html_lang":63,"table_of_contents":140,"faqs":141,"seo_title":142,"seo_description":67,"update_tm":129,"read_time":143,"preview_page_count":8,"preview_urls":144},962085570644,"https://ap-avatar.wpscdn.com/davatar_994ba38a5ba835b3df7d355c54d3ed8d","STUDENTS’ NOTE  \nADVANCED PROGRAMMING I: FUNCTIONS AND ARRAYS/LISTS  \n1. Meaning of a Function  \nA function is a named block of program instructions designed to perform a particular task. A function can receive data as input, process the data, and may return a result.  \nFunctions help programmers to divide a large program into smaller, manageable parts.  \n2. Importance of Functions  \nFunctions are useful because they:  \nReduce repetition of code.  \nMake programs easier to understand.  \nMake debugging easier.  \nAllow code to be reused.  \nMake large programs easier to organize and maintain.  \n3. Components of a Function A function commonly consists of:  \nFunction name – identifies the function.  \nParameters – values supplied to the function.  \nFunction body – contains the instructions to be executed.  \nReturn statement – sends a result back to the part of the program that called the function.  \n4. Example of a Function in Python def add_numbers(a, b):  \nresult = a + b  \nreturn result  \nanswer = add_numbers(5, 3)  \nprint(answer)  \nExplanation:  \ndef is used to define a function.  \nadd_numbers is the function name.  \na and b are parameters.  \nreturn result sends the answer back.  \nadd_numbers(5, 3) calls the function.  \n5. Types of Functions  \nA. Built-in Functions  \nThese are functions already provided by the programming language. Examples in Python include:  \nprint()  \nlen()  \nmax()  \nmin()  \nsum()  \nB. User-defined Functions  \nThese are functions created by the programmer to perform a specific task. Example:  \ndef greet():  \nprint(\"Welcome to programming\")  \ngreet()  \nC. Functions with Parameters  \nThese functions receive values when they are called.  \ndef square(number):  \nreturn number * number  \nprint(square(6))  \nD. Functions Without Parameters  \nThese functions do not require an input value.  \ndef message():  \nprint(\"Good morning\")  \nmessage() ARRAYS/LISTS  \n6. Meaning of an Array  \nAn array is a collection of related values stored under one name. The values are usually accessed using an index.  \nFor example:  \nScores = [65, 72, 80, 55, 90] The collection contains five scores.  \n7. Meaning of a List  \nA list is a data structure used to store multiple items in a single variable. In Python, lists can contain different types of data.  \nExample:  \nstudents = [\"Ali\", \"Amina\", \"John\", \"Mary\"]  \n8. Indexing in Lists  \nEach item in a Python list has an index. Indexing starts from 0.  \nFor example:  \nnames = [\"Ali\", \"Amina\", \"John\"] Index  \nValue  \n0  \nAli  \n1  \nAmina  \n2  \nJohn  \nTo access an item: print(names[0])  \nOutput:  \nAli  \n9. Creating a List  \nA list is created using square brackets [] .  \nfruits = [\"Mango\", \"Orange\", \"Banana\", \"Apple\"] A list can also contain numbers:  \nscores = [45, 67, 78, 89, 92]  \n10. Common List Operations  \nA. Adding an Item  \nThe append() method adds an item to the end of a list.  \nfruits = [\"Mango\", \"Orange\"] fruits.append(\"Banana\")  \nB. Removing an Item fruits.remove(\"Orange\")  \nC. Finding the Length of a List print(len(fruits))  \nD. Sorting a List scores = [70, 45, 90, 60] scores.sort() print(scores)  \nE. Accessing an Item print(scores[2])  \n11. Modifying List Items  \nAn existing item can be changed by assigning a new value to its index. fruits = [\"Mango\", \"Orange\", \"Banana\"]  \nfruits[1] = \"Apple\"print(fruits) The list becomes:  \n[\"Mango\", \"Apple\", \"Banana\"]  \n12. Looping Through a List  \nA for loop can be used to display all items in a list. students = [\"Ali\", \"Amina\", \"John\"]  \nfor student in students: print(student)  \nThe program displays each student's name one after another.  \n13. Combining Functions and Lists Functions can be used to process lists.  \nExample:  \ndef calculate_total(numbers): return sum(numbers)  \nscores = [70, 65, 80, 75]  \ntotal = calculate_total(scores)  \nprint(total)  \nHere, the list scores is passed to the function, which calculates the total.","cbCaiaJnDKp9ko4l","https://ap.wps.com/l/cbCaiaJnDKp9ko4l","pdf",215485,"English","# Functions and Arrays/Lists\n## Meaning of a Function\n## Importance of Functions\n## Components of a Function\n## Example of a Function in Python\n## Types of Functions\n## Meaning of an Array\n## Meaning of a List\n## Indexing in Lists\n## Creating a List\n## Common List Operations\n## Modifying List Items\n## Looping Through a List\n## Combining Functions and Lists","[{\"question\":\"What is a function and what does it do in a program?\",\"answer\":\"A function is a named block of instructions designed to perform a particular task. It can take input data, process it, and may return a result.\"},{\"question\":\"What are the main components of a function?\",\"answer\":\"A function commonly includes a function name, parameters, a function body, and a return statement to send results back to the caller.\"},{\"question\":\"How do you access and modify items in a Python list?\",\"answer\":\"List indexing starts from 0, so you access an item using names[0] style syntax. To modify an item, assign a new value to a specific index, for example fruits[1] = \\\"Apple\\\".\"}]","STUDENTS’ NOTE - ADVANCED PROGRAMMING I - FUNCTIONS AND ARRAYS/LISTS - Notes | PDF",15,[145],{"page_no":8,"url":146,"width":147,"height":148},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/9ce69df9519955b74c094aba4aca5e94.webp",983,1272,{"list":150,"token":66},[151,157,163,169,176,182,189,195,201,208],{"doc_id":152,"doc_title":153,"file_type":137,"home_preview_img_url":154,"slug":155,"view_count":44,"category_name":20,"create_tm":156},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=1796169239&Signature=rGOy5PlDFmrTX%2FiOY3tLZ8rK9zw%3D","142-data-structures-specification-142",1794018669,{"doc_id":158,"doc_title":159,"file_type":137,"home_preview_img_url":160,"slug":161,"view_count":34,"category_name":20,"create_tm":162},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":164,"doc_title":165,"file_type":137,"home_preview_img_url":166,"slug":167,"view_count":39,"category_name":20,"create_tm":168},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":170,"doc_title":171,"file_type":137,"home_preview_img_url":172,"slug":173,"view_count":174,"category_name":20,"create_tm":175},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=1796169239&Signature=ujSS1WE3WKK9klI%2FRaC14nsBm0s%3D","deloitte-python-interview-questions-basic-python-questions",14,1790359985,{"doc_id":177,"doc_title":178,"file_type":137,"home_preview_img_url":179,"slug":180,"view_count":44,"category_name":20,"create_tm":181},657428,"Block Diagrams - Transfer Function Examples - Feedback Loops","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229975459042/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796169239&Signature=paz3%2B97NKaS7QHKd%2Bj77N%2BjhwyY%3D","block-diagrams-transfer-function-examples-feedback-loops",1792979028,{"doc_id":183,"doc_title":184,"file_type":137,"home_preview_img_url":185,"slug":186,"view_count":187,"category_name":20,"create_tm":188},391217,"50+ Data Structure and Algorithms Interview Questions for Programmers","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229917653939/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796169239&Signature=b66CcmPgqWTtpsdjRftzC%2Fu%2BjSc%3D","50-data-structure-and-algorithms-interview-questions-for-programmers",12,1790350190,{"doc_id":190,"doc_title":191,"file_type":137,"home_preview_img_url":192,"slug":193,"view_count":174,"category_name":20,"create_tm":194},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=1796169239&Signature=sM9KnKLb1O8xer5NaO5t%2FOeqeso%3D","ap-computer-science-principles-appendix-2-exam-reference-sheet",1789894352,{"doc_id":196,"doc_title":197,"file_type":137,"home_preview_img_url":198,"slug":199,"view_count":187,"category_name":20,"create_tm":200},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=1796169239&Signature=26yD%2BSr4iD%2Bg%2Fl2VWXO8I6Z6wwE%3D","quiz-02-practice-comp-110-practice-quiz-spring-2024",1790762100,{"doc_id":202,"doc_title":203,"file_type":137,"home_preview_img_url":204,"slug":205,"view_count":206,"category_name":20,"create_tm":207},391470,"Cracking the Coding Interview - Fourth Edition - A Guide to 150 Programming Interview Questions and Solutions","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229917383604/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796169239&Signature=GCzCqlyaA9Y8fzrinh%2FY9HuvWoo%3D","cracking-the-coding-interview-fourth-edition-a-guide-to-150-programming-interview-questions-and-solutions",25,1790353503,{"doc_id":209,"doc_title":210,"file_type":137,"home_preview_img_url":211,"slug":212,"view_count":56,"category_name":20,"create_tm":213},271957,"Function Notation - Practice Problems and Answer Keys","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229899731440/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796169239&Signature=pREY6DkDQPAPA4QgBpObOp8Rwjk%3D","function-notation-practice-problems-and-answer-keys",1789462458]