Answered step by step
Verified Expert Solution
Question
1 Approved Answer
in python please, an example of the file has been provided :) uniqlo item name price category rating 4 puffy jacket89.9 outerwear4.5 3.9 3.5 4
in python please, an example of the file has been provided :)
uniqlo item name price category rating 4 puffy jacket89.9 outerwear4.5 3.9 3.5 4 4.7 4 3.9 4.6 3.3 trench coat 99.9 outerwear sweater tank top polo t-shirt sweatshirt denim shorts29.9 bottoms ankle pants 39.9 bottoms Jeans 29.9 tops 19.9 tops 19.9 tops 14.9 tops 29.9 tops 39.9 bottoms Function name: sort_by_rating Parameters: file (.csv file), category (string), order (boolean) Returns: None Description: You want to see what order the items of a particular category in your file would be in if you sorted them by rating. Given a file, a category of clothing, and an order boolean (True for ascending order, False for descending order), create a function that writes a file called "sorted_items.cSV" that includes all of the items in the specified category in sorted order by ranking The format of the file should look like this: item name item name 1 item name 2 rating rating 1 rating 2 Note: If your input file contains no items in the specified category, your "sorted items.csv" file should still be created and have the header row. Also, your written files should end in a new line character Hint: You can use the built-in Python .sort) method on a list of tuples. The tuples will get sorted by the first item in each tuple. Example: > list_of_tups [(5, "cats"), (6, "kittens"), (1, "lizards")] > list of tups.sort >>> print(list_of tups) [(1, 'lizards'), (5, cats', (6, 'kittens')] > sort by rating("uniglo.csv","tops"True sorted items.csv item name, rating tank top, 3.5 sweater, 3.9 polo, 4.0 sweatshirt, 4.0 t-shirt, 4.7Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started