1. You have been provided a file cereal.csv which contains Comma-Separated Values (CSV) on the nutritional data of 77 brands of cereal. The first line in the file is a header line, which describes what each column corresponds to for the remaining lines.
Using this cereal data, write a program called cereal.py to answer a few interesting questions. To start, write a function makeCerealList () which reads cereal.csv into a list of lists, where each sublist corresponds to one row in the file. Since this is a CSV file, you'll want to use .split(',') on each input line to convert a row with commas into a list of strings with no commas. The function should return the list of lists (data).
Since there is only one filename, you don't need to prompt the use to enter it. You can simply hard-code "cereal.csv" into the main () of your program. Because the provided tests operate on a different file, the makeCerealList () function should take a filename as input. It should return a list of lists, something like this:
[['100% Bran'
'Nabisco', 'Cold', 70, 4, 1, 130, 10.0], ['100% Natural Bran' 'Quaker Oats', 'Cold', 120, 3, 5, 15, 2.0], ['All-Bran', 'Kelloggs', 'Cold', 70, 4, 1, 260, 9.0],
Note: some data has been converted into int and some data has been converted into float.
2. What cereal has the most calories? Write a function most_calories (data) which returns a string; the cereal name that has the most calories.
3. What cereal has the highest protein-to-fat ratio (i.e., protein / fat)? Write a function highest_protein_fat_ratio (data) which returns a string; the cereal name that has the highest protein-to-fat ratio.
4. How many types of 'Hot' cereal are there? Write a function
number_of_hot_cereal (data) which returns an int; the number of cereals with type 'Hot.' For this function, you must use recursion.
5. What cereals are produced by the manufacturer 'Kelloggs'? Write a function
cereals_by_kelloggs (data) which returns a list of strings; the names of the cereals with manufacturer "Kelloggs."
There are included tests with this assignment to help guide you which operate on a smaller CSV file: tiny.cereal.tsv To pass the tests your program should have five functions (as described in points 1-5 above).
You should not hard-code the correct answers into any of the functions. Also, for this assignment you should not use the built-in functions min (), max (), find () or other such "search" functions.
DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma
Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t
Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th
1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of
1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of