Homework 0 - Python Basics
Homework 0 - Python Basics
Learning Objectives :
✓ Reactivate core Python syntax (if/else, loops, etc.) and data structures (lists, tuples,
dictionaries).
✓ Reinforce function creation and usage, including lambda functions.
2. Use a for loop to iterate through the grades list. For each grade, call the categorize_grade()
function to get the letter grade.
3. Store the letter grades in a new list called letter_grades.
4. Print the student names, numerical grades, and letter grades in a formatted table. You can
use string formatting or f-strings for this.
Exercise 3: Data Organization and Lookup (Lists, Tuples, Dictionaries)
1. Create a dictionary called student_data where the keys are student names and the values are
tuples containing the numerical grade and the letter grade. For example: student_data =
{"Assia": (15.35, "C"), "Amine": (12.58, "D"), ...}.
2. Write another function lookup_print_student(name) If the name exists, print the student's
numerical grade and letter grade, else print an appropriate message.
3. Calculate and print the average grade for each letter grade category (A, B, C, D, E, F) using the
student_data dictionary.