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

Dictionary Task 1

The document outlines tasks related to managing student records using dictionaries and lists in Python. It provides examples of student data structures and a series of questions to practice operations such as printing details, updating marks, deleting keys, and adding new entries. Additionally, it includes a nested dictionary example with similar tasks for further practice.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views3 pages

Dictionary Task 1

The document outlines tasks related to managing student records using dictionaries and lists in Python. It provides examples of student data structures and a series of questions to practice operations such as printing details, updating marks, deleting keys, and adding new entries. Additionally, it includes a nested dictionary example with similar tasks for further practice.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Dictionary Task-1:

Example: Student Record System

student = {"roll_no": 101, "name": "Shaik Jani","marks": 89,"grade": "A"}

You can:

 Update marks

 Add subject

 Delete grade

Task-2

# Creating a list of student dictionaries

students = [

"roll_no": 101,

"name": "Shaik Jani",

"marks": 89,

"grade": "A"

},

"roll_no": 102,

"name": "Ravi Kumar",

"marks": 76,

"grade": "B"

},

"roll_no": 103,

"name": "Anjali Mehta",

"marks": 94,

"grade": "A+"
}

✅ Questions:

1. Print the full details of the first student.

2. Print only the name of the second student.

3. Update the marks of the third student to 96 and print the updated record.

4. Delete the grade key from the first student.

5. Add a new key "subject": "Python" to the second student.

6. Print the roll numbers of all three students individually.

7. Print the names of all three students individually.

8. Convert the first student dictionary into a list of keys and print it.

9. Convert the first student dictionary into a list of values and print it.

10. Clear all data of the third student and print the result.

Task-3:

Practice Example: Student Records (Nested Dictionary)

students = {

101: {

"name": "Shaik Jani",

"marks": 89,

"grade": "A"

},

102: {

"name": "Ravi Kumar",

"marks": 76,

"grade": "B"
},

103: {

"name": "Anjali Mehta",

"marks": 94,

"grade": "A+"

Nested Dictionary Practice Questions

1. Print the name and grade of the student with roll number 102.

2. Update the marks of the student with roll number 103 to 96.

3. Add a new key "subject" with value "Python" to the student with roll number 101.

4. Delete the "grade" of the student with roll number 102.

5. Add a new student with roll number 104, name "Meena Reddy", marks 88, and
grade "A".

You might also like