0% found this document useful (0 votes)
7 views7 pages

Python Dictionary Class10

This document provides an introduction to Python dictionaries, explaining that they store key-value pairs similar to a real dictionary. It highlights key features such as being unordered, mutable, and having unique immutable keys, along with basic operations like accessing, adding, updating, and deleting items. Additionally, it mentions useful methods and provides a real-life example of a menu dictionary.

Uploaded by

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

Python Dictionary Class10

This document provides an introduction to Python dictionaries, explaining that they store key-value pairs similar to a real dictionary. It highlights key features such as being unordered, mutable, and having unique immutable keys, along with basic operations like accessing, adding, updating, and deleting items. Additionally, it mentions useful methods and provides a real-life example of a menu dictionary.

Uploaded by

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

Python Dictionary

• Class 10
• Introduction to Python Dictionary
What is a Dictionary?
• A dictionary stores key-value pairs.
• Like a real dictionary:
• 'word' is the key, 'meaning' is the value.

• Example:
• student = {'name': 'Rahul', 'class': 10, 'marks': 92}
Key Features
• - Unordered (but keeps order in Python 3.6+)
• - Mutable
• - Keys are unique & immutable
Basic Operations
• Access: student['name']
• Add: student['age'] = 15
• Update: student['marks'] = 95
• Delete: del student['class']
Useful Methods
• student.keys(), student.values(), student.items()
• student.get('name')
Real-Life Example
• menu = {'burger': 50, 'pizza': 100, 'fries': 40}
• print('Pizza costs', menu['pizza'], 'rupees')
Recap
• ✅ Key-value pairs
• ✅ Use [] or get() to access values
• ✅ Easy to modify

• Keep practicing!

You might also like