Create a dictionary named summary_dict with keys "assignment", "project", "participation", "exam" and "final". The keys are associated with values mean_assignment, mean_project, mean_participation, mean_exam and mean_final of the previous question respectively.Write the dictionary summary_dict into a pickle file named grades.pkl.In [ ]:# import pickleimport pickle# store grades using picklesummary_file = 'grades.pkl'# your code here
Question
Create a dictionary named summary_dict with keys "assignment", "project", "participation", "exam" and "final". The keys are associated with values mean_assignment, mean_project, mean_participation, mean_exam and mean_final of the previous question respectively.Write the dictionary summary_dict into a pickle file named grades.pkl.In [ ]:# import pickleimport pickle# store grades using picklesummary_file = 'grades.pkl'# your code here
Solution
Here is the Python code to create a dictionary and write it into a pickle file:
# Create a dictionary
summary_dict = {
"assignment": mean_assignment,
"project": mean_project,
"participation": mean_participation,
"exam": mean_exam,
"final": mean_final
}
# Write the dictionary into a pickle file
with open('grades.pkl', 'wb') as f:
pickle.dump(summary_dict, f)
Please replace mean_assignment, mean_project, mean_participation, mean_exam, and mean_final with the actual values.
Similar Questions
Use Pandas to read the file grades.csv in the current directory. It contains the partial grades of about 300 students from a previous course.Compute the mean grade for each of the categories: assignments, project, participation, and exam. Assign these values to the variables below respectively. mean_assignment mean_project mean_participation mean_examThe final grade is consist of 30% of assignments, 30% of project, 10% of participation and 30% of exam. First, please add a new column "final_grade". Then, compute the mean final grade and assign it to the variable below. mean_finalIn [1]:# import pandas import pandas as pd# read grades.csv filedata = pd.read_csv("grades.csv", index_col=0) # look at the first five rows of the grades datasetdata.head()executed in 1.89s, finished 14:17:12 2023-11-23Out[1]:program assignments project participation examuniqueNo 1 JC21 100.00 94.63 100 832 CDS 96.92 93.50 100 84222 JC21 88.00 94.00 100 9210 APSY 96.23 88.38 100 88209 FLL 88.00 95.75 90 91In [8]:# Compute the mean grade for each of the categories: assignments, project, participation, exam. # Assign these values respectively to the variables below:# mean_assignment# mean_project# mean_participation# mean_exam# your code here
Question 2: Given a list of student names and their corresponding scores:student_scores = ["John: 85", "Emma: 92", "Michael: 78", "Sophia: 95", "William: 88"]Create a dictionary using a dictionary comprehension where the student name is the key and the score is the value. Only include students whose scores are greater than or equal to 90.
Writing a program using 'from' keyword along with importing asterisk (*).Write a program to calculates sum, average and final grade of a student using * in import.import all the functions from Module_Imp3.py using *.Taken the scores of a student as input from user.Calculate the sum of scores using the calculate_sum function by passing scores as argument.Calculate the average of scores using the calculate_average function by passing scores as argument.Determine the final grade based on the average score using the determine_grade function.Note: The Module_Imp3.py already is written. Just follow the above instructions and complete the program.Sample Test CasesTest Case 1:Expected Output:Enter·the·scores·separated·by·spaces:·90 85 70 60 75Sum·of·scores:·380.00Average·score:·76.00Final·grade:·CTest Case 2:Expected Output:Enter·the·scores·separated·by·spaces:·85.5 76.5 90.0 82.0 95.5Sum·of·scores:·429.50Average·score:·85.90Final·grade:·B
You have a class consisting of 5 students, each with a unique name and their respective marks. As the end of the semester approaches, you decide to assess the performance of your students and recognize their academic achievements.You write a Python program to categorize the students into different grades based on their marks. The program utilizes a Grade_analyzer class to represent each student and a StudentGradeAnalyzer function to analyze their grades. The function iterates through the list of students, calculates their grades and returns a dictionary containing the count of students in each grade.For grading:Students scoring between 80-100 will be in Grade A.Students scoring between 70-80 will be in Grade B.Students scoring between 60-70 will be in Grade C.Students scoring between 50-60 will be in Grade D.Students scoring below 50 will be in Grade E.Constraints:Input Format:5 lines of input, each line containing name and marks of each student.Ouptut Format:Should display items in dictionary which is holding Grades as keys and count of students falling under the grades as values.Example:Input:john 78missy 89sheldon 90mary 45meemaw 67Output:('A', 2)('B', 1)('C', 1)('D', 0)('E', 1)Explanation:input:--------Space saperated input name and marks for all the 5 students.john 78-->78 Falls into a range 70-80 so count of grade 'B' should be increased to 1.missy 89-->89 Falls into a range 80-100 so count of grade 'A' should be increased to 1.sheldon 90-->90 Falls into a range 80-100 so count of grade 'A' should be increased to 2.mary 45-->45 is less than 50 so count of grade 'E' should be increased to 1.meemaw 67-->67 Falls into a range 60-70 so count of grade 'C' should be increased to 1.
# Write a function in python which accept a list of marks of students and return the# minimum mark, maximum mark and the average marks. Use the same function to test
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.