Programming Assignment #3 (40). Objective: dictionaries, Murach Chapter 12).
Due Monday November 21, 8PM. Late penalties-10% until 11:59PM -40% until 1PM, November 22
The structure of this program must be similar to the one in program 2
Start with the initial stud Grades of assignment #2. DO NOT READ IT FROM A FILE .
Your program will transform this table into a table where each row is s a dictionary. As an example, here is what the first two intial rows:
[ [1111 , “L” , “ART” ,”CC” , “Junior” , 3.5 , 7.8 , 4 , 2, 6],
[1256 , “L” , “MIS” ,”No” , “Soph” , 1.2 , 7.3 , 9.5 , 5, 10],
will become:
[{‘id’: 1111, ‘gradeType’: ‘L’, ‘major’: ‘ART’, ‘transfer’: ‘CC’, ‘year’: ‘Junior’, ‘gpa’: 3.5, ‘proj1’: 7.8, ‘proj2’: 4, ‘exam1’: 2, ‘exam2’: 6},
{‘id’: 1256, ‘gradeType’: ‘L’, ‘major’: ‘MIS’, ‘transfer’: ‘No’, ‘year’: ‘Soph’, ‘gpa’: 1.2, ‘proj1’: 7.3, ‘proj2’: 9.5, ‘exam1’: 5, ‘exam2’: 10}
All rows are dictionaries, all rows have the same keys, which are
‘id’ ‘gradeType’ ‘major’ ‘transfer’ ‘year’ ‘gpa’ ‘proj1’ ‘proj2’ ‘exam1’ ‘exam2’
This is a way to refer to an element of the table by its name (e.g. ‘gpa’) rather than its column number (we still need to provide its row # to identify it completely).
To get credit for this question, the tansformation described here must be done by your program, using loop(s).
Display the rows of the tables with values 1111, 1888, 3333 for the key ‘id’
Dictionaries, “Key” and “value” have speciific Python meaning.
Using the list of dictionaries, compute the average gpa. Compute how many students have their gpa greater than the average gpa. PRINT both results.
A. Using the list of dictionaries, compute the number of students in each major and display.
Compute the average gpa for each major and display
a. Write a program to transform the list of dictionaries into a big dictionary . Display the new dictionary, in a very legible way
big_New_Dict = { 1111: {‘gradetype’:’L’, … ‘exam2’:6},
1256: {‘gradetype’:’L’, … ‘exam2’:10},
b. Using big_New_Dict, compute the average gpa. Compute the number of students in each major and display.
FORMATTING OF THE PROGRAM. Like Murach, page 343. However, do not use comments like “convert string to list”.
When you have a program well formatted using IDLE, it may happen that the good formatting disappear when you upload to canvas . This makes my work of understanding your program very hard. No credit for the questions where it happens. Solution: rewrite with short lines of code, using explicit continuation . That means: upload your work much before the deadline. Similarly, the execution output must be legible.
Last Completed Projects
topic title | academic level | Writer | delivered |
---|