fix(curriculum): corrected dict() example value types (#65255)

This commit is contained in:
Lakshay Goyal
2026-01-16 20:07:12 +05:30
committed by GitHub
parent ea13e7fe1c
commit 20d3983560
@@ -55,46 +55,46 @@ To create a Python dictionary, you just need to write the key-value pairs within
```python
my_dictionary = {
"A": 1,
"B": 2,
"C": 3
'A': 1,
'B': 2,
'C': 3
}
```
In this code, `"A"` is the key and `1` is the value:
In this code, `'A'` is the key and `1` is the value:
```python
"A": 1
'A': 1
```
Alternatively, you can use `dict()`:
```python
my_dictionary = dict(A="1", B="2", C="3")
my_dictionary = dict(A=1, B=2, C=3)
```
You can get the value through its corresponding key:
```python
my_dictionary["A"] # 1
my_dictionary['A'] # 1
```
You can also update the value associated with a key:
```python
my_dictionary["A"] = 4
my_dictionary['A'] = 4
```
And you can remove a key-value pair:
```python
del my_dictionary["A"]
del my_dictionary['A']
```
You can also check if a key is in the dictionary (or not):
```python
"C" in my_dictionary
'C' in my_dictionary
```
And you can call these methods to get the keys, values, and items of the dictionary, respectively.