Welcome to unit 6!
Unit 6 provides comprehensive coverage of Python lists. You’ll learn how these lists compare to and contrast with strings, including how lists are sequences like strings, can be traversed with for loops, have a slice operator (“”), and have many useful methods. However, lists differ from strings in that they can store more than just characters. Finally, lists are mutable, meaning that their elements can change. Lists’ mutability is an example of some complex Python concepts, such as objects, references, and aliasing.
The reading for unit 6 also introduces a number of useful concepts, including list slices, augmented assignment operators like “+=,” reduction operations like “sum,” map operations that modify all the elements of a list, and filter operations that select out elements from lists. The unit is concluded with a thorough note on the use of lists as function arguments.Attribution”Figure 10.1 State Diagram” by Allen Downey is licensed under CC BY-NC 3.0. To view a copy of this license, visit https://creativecommons.org/licenses/by-nc/3.0/
Reading Assignments are designed to expand your knowledge of the topics introduced in the Overview and provide the knowledge you will need to successfully complete the assignments in this unit. As you read through the learning resource and watch the videos consider the following:
What are the key features of lists?
What distinguishes a list from a string?
What are the eight list methods?
ReadDowney, A. (2015). Think Python: How to think like a computer scientist. Chapter 10 – Lists
Watch Optional Video Lectures: The following are video lectures that cover many of the same topics as are introduced in the reading assignment and unit overview. These lectures are NOT required, they are provided as a supplemental learning opportunity for those who can and want to take advantage of them.
Watch: Python Lists
Watch: For Loops in Python
Watch: While Loops in Python
ReferencesDowney, A. (2015). Think Python: How to think like a computer scientist. Green Tea Press. https://greenteapress.com/thinkpython2/thinkpython2.pdf
Khan Academy. (2011, June 30). Python lists [Video]. YouTube.
Khan Academy. (2011, June 30). For loops in Python [Video]. YouTube. http://www.youtube.com/watch?v=9LgyKiq_hU0
Khan Academy. (2011, June 30). While loops in Python [Video]. YouTube. http://www.youtube.com/watch?v=D0Nb2Fs3Q8c
Welcome to the Unit 6 Discussion Forum!
Use the terms “equivalent” and “identical” to distinguish between objects and values. Illustrate the difference further using your own examples with Python lists and the “is” operator.
Using your own Python list examples, explain how objects, references, and aliasing relate to one another.
Finally, create your own example of a function that modifies a list passed in as an argument. Hence, describe what your function does in terms of arguments, parameters, objects, and references.
Create your own unique examples for this assignment. Do not copy them from the textbook or any other source.
The code and its output must be explained technically whenever asked. The explanation can be provided before or after the code, or in the form of code comments within the code. For any descriptive type question, Your answer must be at least 150 words.
End your discussion post with one question related to programming fundamentals learned in this unit from which your colleagues can formulate a response or generate further discussion. Remember to post your initial response as early as possible, preferably by Sunday evening, to allow time for you and your classmates to have a discussion.
When you use information from a learning resource, such as a textbook, be sure to credit your source and include the URL. Continue to practice using APA format for citations and references.
Assignment Instruction:By the end of this assignment, you will be able to perform addition, deletion, and sorting on the elements of the list as well shall be able to experiment list and related operators
(a). Consider that you are working as Data Analyst in an organization. The HR department needs you to carry out following operation on existing list of 10 employees name (you can assume 10 names in a list here).
Split the list into two sub-list namely subList1 and subList2, each containing 5 names.
A new employee (assume the name “Kriti Brown”) joins, and you must add that name in subList2.
Remove the second employee’s name from subList1.
Merge both the lists.
Assume there is another list salaryList that stores salary of these employees. Give a rise of 4% to every employee and update the salaryList.
Sort the SalaryList and show top 3 salaries.
Write the Python code and output for the same.
(b). Design a program such that it converts a sentence into wordlist. Reverse the wordlist then. Write the code and output for the same.
Note: The code and its output must be explained technically. The explanation can be provided before or after the code, or in the form of comments within the code.
Submission Instructions:Upload a word document for the submission
If you use an informational source, be sure to identify the source and share the link to the source you used. Practice using APA citations and references when you use ideas from the readings or other sources.
This assignment will be assessed by your instructor using the rubric available on the assignment page located on the course homepage.
The postappeared first on .