Activities

1 - student_dict.py
# 1. Create a dictionary with keys: 'Name', 'Age', and 'Subject'.
# Values should be 'Alice', 16, and 'Math'.


# 2. Access the student's name from the dictionary.
# Use the key inside square brackets.


# 3. Access the student's age.


# 4. Access the student's subject.

2 - update_dict.py
# 1. Create a dictionary with keys: 'Name', 'Age', and 'Subject'.


# 2. Update the student's age to 18.


# 3. Add a new key-value pair for 'Grade' with a value of 'A'.


# 4. Print the updated dictionary.

3 - loop_dict.py
# 1. Create a dictionary with keys: 'Name', 'Age', and 'Subject'.


# 2. Loop through the dictionary and print each key and value.

Last updated