Question: Question 1 : ( 1 0 Marks ) Lists Create a list named vegetables containing the following items: 'carrot', 'broccoli', 'spinach', 'potato'. Write a code

Question 1: (10 Marks)
Lists
Create a list named vegetables containing the following items: 'carrot', 'broccoli', 'spinach', 'potato'.
Write a code to display vegetables in the list that start with the letter 's'.
Dictionaries
Create a dictionary named class_scores where each key is a student's name, and each value is a nested dictionary containing subject names as keys and scores as values. Initially, add the following data for each student:
"Eve": Math -78, Physics -82, Chemistry -89
"Frank": Math -91, Chemistry -85, Biology -76
"Grace": Physics -89, Chemistry -94, Math -81
Write a function update_score(class_scores, student, subject, score) that:
Adds a new subject with the score if the subject does not already exist for the student.
Updates the score only if the new score is higher than the existing one.
Use this function to:
Update Eve's Math score to 85.
Add English with a score of 90 for Frank
Question 1 : ( 1 0 Marks ) Lists Create a list

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!