Question: The uploaded file must have .py extension. Name your Python program as follows: Hw5_Surname_Name.py (with only english characters in the file name, and of course

The uploaded file must have .py extension. Name your Python program as follows: Hw5_Surname_Name.py (with only english characters in the file name, and of course with your own names). Example: Not Hw5_Akll_iek.py, but Hw5_Akilli_Cicek.py Your homework solution will contain comment lines containing your firstname, lastname, student id, department and your CS101 section number. The due date is announced in LMS. Write a single Python program that includes all five tasks (parts) explained below. Part 1: 20pts Write a function removeDuplicates() that gets a list as parameter, and return a new list in which the duplicate items are removed. (While removing duplicated items in the list, print those items. +5 pts.) Write Python statements that create a list with [4, 8, 15, "aero", 4, 23, "aero", 2, 1, 19, 1, 1, 8], call removeDuplicates() function and print final list as shown in the sample run below. Part-1: Removing 4 Removing aero Removing 1 Removing 1 Removing 8 Unique List: [4, 8, 15, "aero", 23, 2, 1, 19] Part 2: 20pts Write a function printStocks() that gets a dictionary as explained below, loops through each element and prints out the key along with its price and stock information. The output will be in the format shown below. Create a empty dictionary called "stocks" using {} format. The key of this dictionary is name of an item and the value is a list containing two numbers (first element of that list is stock and second element is relevant price). Put the following values in your "stocks" dictionary: "banana": [4, 5], "apple": [2, 2], "orange": [1.5, 2.5], "pear": [3, 4] Call the printStocks() function to print the stocks. Then find and print the total value of the stocks. The value of each item is computed by multiplying the stock value by price value. CS101 Homework-5 2 Part-2: banana Price:4 Stock:5 apple Price:2 Stock:2 orange Price:1.5 Stock:2.5 pear Price:3 Stock:4 Total value of all items: 39.75 Part 3: 20pts Write a function decodeString() that takes a string. Decode your string it via dictionary below. answers = {"A": "S", "B": "X", "F": "D", "G":"R", "K": "L", "S": "M", "P":"T", "X":"E", "Y":"C"} Note: If a char is not in the dictionary decode as "?" Write Python statements that ask the user to input a word, then call the method and print the returned result. Part-3: Enter a string to decode: QAXYGXP Decoded string: ?SECRET Part 4: 20pts Write a Python function removeSmallestItem() that takes one dictionary. Iterate over values and remove the smallest value from dictionary. (Do not use sort function) Write Python statements that create a dictionary with d={"Futurama":1999, "The Simpsons":1989, "Rick and Morty":2013, "Death Note":2006} call removeSmallestItem() function and print final dictionary as shown in the sample run below. Part-4: {'Futurama': 1999, 'Rick and Morty': 2013, 'Death Note': 2006} Part 5: 20pts Write a function findMaxTuple() that gets a list of tuples as parameter, finds and returns the tuple with maximum sum inside the list. Write Python statements that create a sample list that has tuples inside (you can use the list of tuples in the sample run below), then use findMaxTuple() function to get the tuple with maximum sum and print it. Part-5: Sample tuples= [(3, 4, 360, 6), (1, 2), (12, ), (132, 244, 64), (72, 71, 70)] Maximum tuple is (132, 244, 64) CS101 Homework-5 3 Your program code may look as follows: # Firstname(s) Lastname # StudentId # Department # Section number (Section-1 or Section-2 or Section 3 or Section 4) print("Part-1") .... print(" Part-2") .... print(" Part-3") .... print(" Part-4") .... print(" Part-5")

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!