Skip to player
Skip to main content
Skip to footer
Search
Connect
Watch fullscreen
Like
Comments
Bookmark
Share
Add to Playlist
Report
Lecture 43: Python has Un-changeable dic key
Nafees AI Lab
Follow
5/18/2025
In Python, a dictionary stores data as key-value pairs. Each key within a dictionary must be unique and immutable, meaning it cannot be changed after it's created. Common data types used for keys include strings, numbers, and tuples
Category
📚
Learning
Transcript
Display full video transcript
00:00
There is a small concept that I had to iterate on the definition, but I thought that you can clear that the dictionary's keys are immutable.
00:12
The immutable data types of data types, you can replace them.
00:18
For example, string is a immutable data type.
00:23
You can replace it.
00:33
This is a single pair of dictionary.
00:38
You can replace it.
00:44
If I run it, it's quite happy.
00:47
The key is immutable.
00:57
The key is immutable.
01:00
The immutable data type is false.
01:04
We have false.
01:06
We see false.
01:09
Nice.
01:10
However, one thing we have noted is that the list is mutable.
01:15
It is immutable.
01:16
We have indexing and change the value.
01:19
The list is equal to 1, 2, 3.
01:26
One, two, three.
01:27
So, I would say that the list of index is zero.
01:33
I would not assign value to 2.
01:36
I would say that.
01:37
How was it possible?
01:39
The list is immutable.
01:41
I would say that the string is immutable.
01:45
Basically, the dictionary is the key is immutable.
01:50
Now, because the list is immutable,
01:52
you can say that one of this list is equal to this thing.
01:57
Now, I will run it.
01:59
It's mad on me.
02:00
Okay.
02:01
It's a unhashable type.
02:05
You cannot add this thing.
02:07
Okay.
02:08
Interesting.
02:09
So, you can use any key, any data type except which is mutable.
02:19
Which is mutable.
02:20
The change is not.
02:21
Okay.
02:22
A small thing is to have to use which type is best.
02:29
Of course, you will know what experience is.
02:32
Which type is best.
02:36
Imagine you have to develop a game.
02:38
Now, we're in game today we have a player of countryاشita save.
02:46
We're in this new movement,
02:47
We,...
02:48
Now, we have the list node the circle which � client.
02:50
You can use characteristics...
02:51
Characteristics.
02:52
Ok.
02:53
Carestan is ...
02:54
Characteristics...
02:55
א...
02:57
Characteristics.
02:58
And ...
02:59
Characteristics is a name to have a group.
03:01
Let's call...
03:02
Let's say power,
03:05
let's say power
03:07
ठीक है और उसके पास
03:09
let's say bonus है
03:11
and so on
03:13
however
03:14
this is not
03:18
the property
03:19
is not the property तरीका exist
03:21
करता है और वो
03:22
basically इसको dictionary में आप define कर सकते है
03:25
तो आप कहें dictionary
03:26
ठीक है is equal to
03:28
एक नई dictionary आप define करने लगा है
03:30
उसकी खासित यह है
03:33
कि आप उसमें कहते हैं player
03:34
ठीक है, key is equal to, अब जरा आपने गवर करना है, player, और player करने हैं, let's say, john, या name, ठीक है, उसके साथ, power,
03:52
full, अब देखिए, यह मज़ीद descriptive हो गया न, अब मैं, for example, मैं कहता हूँ, bonus, ठीक है,
04:08
two lives, अब मज़ीद descriptive हो गया न, और अब मैं easily, जब भी dictionary की player के, let's say, power call करूंगा,
04:21
तो मुझे उसका status देगा, कहेगा powerful, अजी, however, जो list है, उसके अंदर यह ऐसा descriptive नहीं है,
04:30
यह एक छोटी सी example दिया है, कि कौन सी application के लिए कौन सा data structure बहतर है,
04:35
तो आपने इस बात से, इस अवाले से mindful रहना है, कि list हो, यह dictionaries हो, यह application specific है,
04:44
यह ऐसा नहीं है, कि dictionary अच्छी होती है list से, और list अच्छी होती है dictionary से,
04:49
कोई list मारी, कोई list के साथ, यह तो नहीं है, को personal friendship है,
04:54
basically, अगर हमने एक data structure को preference देनी है, on the other data structure, as a developer,
05:01
तो हमें पता होना चाहिए, कि यह list application के लिए suitable है, ठीक है न, तो इस बात का दियान रखने,
Recommended
8:48
|
Up next
Lecture 42: Dictionary in Python Language
Nafees AI Lab
5/18/2025
7:51
Lecture 44: Most Used Dictionary Methods in Python
Nafees AI Lab
5/18/2025
9:15
Lecture 45: Tuple Data Types in Python
Nafees AI Lab
5/18/2025
11:19
Lecture 53: Python has for loop and Iterables
Nafees AI Lab
5/20/2025
9:59
Lecture 37: Python has Data Structor and Lists-II
Nafees AI Lab
5/17/2025
8:19
Lecture 36: Python has Data Structor and Lists
Nafees AI Lab
5/17/2025
8:22
Lecture 46: Set Data Types in Python
Nafees AI Lab
5/18/2025
4:57
Lecture 29: Type Conversion in Python
Nafees AI Lab
5/15/2025
3:23
Lecture 79: Sets and Dictionary Comprehension in Python
Nafees AI Lab
5/23/2025
4:03
Lecture 76: Python has Special Function Zip
Nafees AI Lab
5/23/2025
10:23
Lecture 78: List Comprehension in Python
Nafees AI Lab
5/23/2025
12:23
Dictionary in Python
Top news
9/5/2022
6:49
Lecture 74: Python has Special Function Map
Nafees AI Lab
5/23/2025
4:52
#13 Python Tutorial for Beginners // Swap 2 Variables in Python
Top news
9/5/2022
4:52
Lecture 50: Python with Boolean values
Nafees AI Lab
5/18/2025
3:41
Lecture 32: Python is Immutable
Nafees AI Lab
5/16/2025
0:27
Making waterproof shoes with duct tape! 👌🏞️
MetDaan Creative
5 days ago
0:16
When it's your boyfriend's laundry day! 😅🤣
MetDaan Creative
5 days ago
0:24
Spreading chocolate cream with a plaster! 😅🍞
MetDaan Creative
5 days ago
7:40
Mera Mazloom Hussain | Nadeem Sarwar 2020 | 1442
Gham-e-Hussain | غمِ حسینؑ
6/9/2025
9:38
Episode 1 – The Curious Boy from Ulm (1879-1895)
Nafees AI Lab
6/8/2025
0:37
Top Fully Funded Scholarships in Germany 2025 🇩🇪 | Apply Now!
Nafees AI Lab
6/3/2025
0:25
The Boy and the Dragon – “A Friend in the Sky”
Nafees AI Lab
6/3/2025
1:03
Why Do Rainbows Appear? 🌈 | Physics in Everyday Life
Nafees AI Lab
6/3/2025
0:28
Albert Einstein: The Genius Who Changed Time
Nafees AI Lab
6/1/2025