Question: Python programing assignment 7 - UDT Lists Purpose: Use User Defined Types and Lists Create a User Defined Type to manage this data, (data excerpt):
Python programing assignment 7 - UDT Lists
Purpose: Use User Defined Types and Lists
Create a User Defined Type to manage this data, (data excerpt):
Shampoo,7.35 Roast beef,20.67 Shrimp,17.92 Egg Nog,11.82 Popsicles,3.77 This excerpt is from the data file UPRODUCTS.csv
.
Specification:
* Read the data file, and for each product in the data file, sort it in an alphabetic list, based on the first letter of the product. For example, store "Shampoo,7.35" in the 'S' list.
* After reading in the entire data file, sort each alphabetic list.
* After sorting each list, place each list in a Master List, starting with list [A] and ending in list [Z].
* Write a searching algorithm to search for an item in the Master List. For example, find "Shampoo" in the Master List [S] position.
Notes:
1. There are duplicates in the data file, but have different prices. For example, Salmon,16.39,Salmon.14.72. Your program doesn't need to handle the duplicates, but you can if you want.
2. One student suggested that putting all the data into one big list, and then doing a Binary Search to find the data would be a more efficient algorithm, which is true. However, this exercise is intended to teach handling lists rather than sorting techniques. Insidently, a BinarySearch would take about 8 searches to find "Shampoo", where the searching method, outlined in this assignment, would take about 16 searches.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
