Module 4: Data Collections and Functions
Lab: Lab 4.2: Data Structures Challenge - Student Grades
Create a dictionary called grades
to store the grades of three students: Alice (85), Bob (92), and Charlie (78). Then, calculate and print the average grade of these students.
Tasks to Complete:
- Create a dictionary named `grades`.
- Add three entries: "Alice" with a value of 85, "Bob" with 92, and "Charlie" with 78.
- Use the `sum()` function on `grades.values()` to get the total of all grades.
- Use the `len()` function on `grades` (or `grades.keys()`, `grades.values()`) to get the number of students.
- Calculate the average grade (total grades / number of students).
- Print the average grade.
Python Sandbox
Python execution is powered by Pyodide, running directly in your browser. The `input()` function is not supported in this sandbox; please define variables directly in your code.