0% found this document useful (0 votes)
30 views3 pages

Dictionary Practice Questions

The document outlines tasks for managing student records using Python dictionaries in a university setting. It includes creating a student management system with functionalities such as displaying student details, calculating average marks, and adding new records. Additionally, it describes data analysis tasks involving converting data structures and searching for students based on specific criteria.

Uploaded by

jawadahsan286
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views3 pages

Dictionary Practice Questions

The document outlines tasks for managing student records using Python dictionaries in a university setting. It includes creating a student management system with functionalities such as displaying student details, calculating average marks, and adding new records. Additionally, it describes data analysis tasks involving converting data structures and searching for students based on specific criteria.

Uploaded by

jawadahsan286
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Dictionary in Python

Dictionary Practice Questions

Student Management System

Scenario:

You are working as a student database manager at a university. You need to manage and
process student records using a dictionary.

Tasks:

1- Create a dictionary named students_data where each student's roll number is the
key, and the value is another dictionary containing:

 "Name": Student's full name


 "Age": Student's age
 "Marks": A dictionary containing marks of Math, Science, and English

students_data = {

"S101": {"Name": "Ali Ahmed", "Age": 20, "Marks": {"Math": 85, "Science": 90, "English": 88}},

"S102": {"Name": "Sara Khan", "Age": 22, "Marks": {"Math": 78, "Science": 85, "English": 80}},

"S103": {"Name": "Tayyab Khushi", "Age": 21, "Marks": {"Math": 92, "Science": 95, "English": 89}}

2- Write a function to display the details of a student when the roll number is provided as
input.
3- Write a function to calculate and print the average marks of each student.
4- Write a function to find and print the name of the student with the highest total
marks.
5- Write a function to add a new student record dynamically by taking user input for roll
number, name, age, and marks.

Hafiz Muhammad Tayyab Khushi


Dictionary in Python

Scenario:

You are working as a data analyst for a university’s student record system. You have been given
a dictionary containing information about students. Your task is to process, analyze, and
manipulate this data using Python dictionaries.

students_data = {

'Name': ['Abdur Rehman', 'Muhammad Qasim', 'Amna', 'Maryam'],

'Age': [30, 5, 1, 1],

'Gender': ['M', 'M', 'M', 'F'],

'City': ['Lahore', 'Multan', 'Islamabad', 'Lahore'],

'Qualification': ['PhD', 'MS', 'BS', 'Inter']

Tasks:

1. Convert the given dictionary into a list of dictionaries where each student’s details are
stored as an individual dictionary inside a list.

{'Name': 'Abdur Rehman', 'Age': 30, 'Gender': 'M', 'City': 'Lahore', 'Qualification': 'PhD'},

{'Name': 'Muhammad Qasim', 'Age': 5, 'Gender': 'M', 'City': 'Multan', 'Qualification': 'MS'},

...

2. Write a function that allows the user to search for a student by name and display their
details.
3. Write a function to find all students from a specific city (e.g., input "Lahore" should
return both "Abdur Rehman" and "Maryam").

Hafiz Muhammad Tayyab Khushi


Dictionary in Python

4. Write a function that counts and displays the number of male and female students in
the dataset.
5. Write a function to find the student with the highest qualification level (PhD → highest,
Inter → lowest). Use the given order: PhD > MS > BS > Inter
6. Write a function that adds a new student’s record dynamically by taking user input for
name, age, gender, city, and qualification.
7. (Bonus Task) Convert the list of dictionaries into a Pandas DataFrame and display it.

~~ Best of Luck ~~

Hafiz Muhammad Tayyab Khushi

You might also like