Python Tuples and Dictionaries Assignment

Introduction:
This assignment is designed to help you practice working with Python tuples and dictionaries. These are essential data structures that you’ll encounter frequently in Python programming. The tasks are straightforward and aimed at reinforcing your understanding of tuples and dictionaries.

Objective:
The main goals of this assignment are:

Get comfortable with creating and manipulating tuples.
Understand the basics of dictionaries and how to perform operations on them.
Apply your knowledge in simple, real-world scenarios.

Assignment Tasks:

Task 1: Tuples Practice

Create a tuple for three students with their (ID, name, age, GPA).
Write a function to display a student’s details based on their ID.
Calculate the average GPA of all students.
Add a new student to the tuple.
Task 2: Dictionaries Challenge

Create a dictionary for a small library with book details (title, author, genre, copies available).
Write a function to display book details based on the title.
Update the number of copies for a specific book.
Add a new book to the library.
Task 3: Fun with Both

Create a list of tuples, each pairing a student with their preferred book (ID, preferred book title).
Write a function to match students with their preferred books using dictionaries and tuples.
Task 4: Reflect and Write

Reflect on the challenges faced during the assignment and how you solved them.
In a short essay, share your understanding of tuples and dictionaries, and how they can be useful in practical situations.
References:
Use your class notes and the Python documentation for reference.

This assignment aims to make learning fun and practical while reinforcing the key concepts of tuples and dictionaries in Python.

Leave a Reply

Your email address will not be published. Required fields are marked *