subject

Read file (fp) → D1, D2,D3:a) This function read a file pointer and returns 3 dictionaries: - Parameters:file pointer (fp) - Returns: 3 dictionaries of list of tuples - The function displays nothing b) You must use the csv. reader because some fields have commas in them. CSE 231 Spring 2020 c) Each row of the file contains the name of a video game, the platform which it was released, the release year, the genre (i. e. shooter, puzzle, rpg, fighter, etc.), the publishing company, and regional sales across north America, Europe, Japan, and other regions. For this project, we are only interested in the following columns: name = line [0] platform = line[1] year = int(line [2]). genre = line [3] publisher = line [4] na sales = float (line [5]) europe_sales = float (line [6]) japan_sales = float (line [7]) other sales = float (line [8]) d) All strings should be converted to lower case and stripped of the trailing/forward white spaces. e) Multiply each regional sales column by 1,000,000. The program must compute the total global sales by adding all the regional sales (na_sales, europe_sales, japan_sales, other_sales).f) This function returns 3 separate dictionaries. The first dictionary, with 'name' as key, will contain the data used to display the global sales per year or platform. The second dictionary, with 'genre' as key, contains the data used to display the regional sales per genre. The third dictionary, with 'publisher' as key, contains the data used to display the global sales by publisher. All of 3 dictionaries have a list of tuples as values: D1 = { name: [ (name, platform, year, genre, publisher, global_sales), ...), ...} D2 = { genre: [ (genre, year, na_sales, eur_sales, jpn_sales, other_sales, global_sales), ...), ...} D3 = {publisher: [(publisher, name, year, na_sales, eur_sales, jpn_sales, other_sales, global_sales), ...], ...) You should ignore all the values that are not valid: - 'year' should be integer (int) - All regional sales should be floats (floats). g) Once the file is read and all the data is stored in the 3 dictionaries, you need to sort each dictionary alphabetically in ascending order by their keys. The values for the 3 dictionaries should also be sorted by the last element of the tuples in reverse order (global_sales).

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 22:30
Type the correct answer in the box. spell all words correctly.what kind of graph or chart does this image represent? the given image represents a (blank).
Answers: 2
question
Computers and Technology, 22.06.2019 13:00
We as humans write math expression in infix notation, e.g. 5 + 2 (the operators are written in-between the operands). in a computer’s language, however, it is preferred to have the operators on the right side of the operands, i.e. 5 2 +. for more complex expressions that include parenthesis and multiple operators, a compiler has to convert the expression into postfix first and then evaluate the resulting postfix.write a program that takes an “infix” expression as input, uses stacks to convert it into postfix expression, and finally evaluates it. it must support the following operations: + - / * ^ % (example infix expression: (7 - 3) / (2 + 2)postfix expression: 7 3 - 2 2 + /result: 1guidelines: 1. you will need to use stacks in three placesa. one for the parenthesis check [char stack]b. one during infix to postfix [char stack]c. one during evaluation [int stack]for a and b above, you can use same array and same push, pop method as both ofthem are char. but for evaluation you have int stack and you might consider to createanother push pop method to handle it. maybe push_int, pop_int, etc. or find otherstrategy to utilize existing push pop method2. you can create a function for obtaining operator priority. that function should take anoperator as input and return its priority as an integer. this function will you a lot andreduce repeated code3. during evaluation you will need to convert char into integer. example for single digit: char c = '5'; int x = c - '0';
Answers: 2
question
Computers and Technology, 22.06.2019 20:00
Which type of file can be used to import data into a spreadsheet?
Answers: 1
question
Computers and Technology, 23.06.2019 05:20
What did creator markus “notch" persson initially call his game
Answers: 1
You know the right answer?
Read file (fp) → D1, D2,D3:a) This function read a file pointer and returns 3 dictionaries: - Parame...
Questions
question
English, 17.10.2021 14:00
question
Mathematics, 17.10.2021 14:00
question
Mathematics, 17.10.2021 14:00
question
English, 17.10.2021 14:00
question
History, 17.10.2021 14:00