---
title: "What is meant by dictionary in python?Give suitable example."  
description: "What is meant by dictionary in python?Give suitable example."  
author: "Amrita Bhattacharjee"  
published: 2023-03-28  
updated: 2023-05-01  
canonical: https://www.mindstick.com/forum/157622/what-is-meant-by-dictionary-in-python-give-suitable-example  
category: "python"  
tags: ["python"]  
reading_time: 2 minutes  

---

# What is meant by dictionary in python?Give suitable example.

What is meant by [dictionary](https://www.mindstick.com/articles/1500/hashtable-and-dictionary-in-c-sharp) in [python](https://www.mindstick.com/articles/75378/simple-yet-useful-tips-when-using-python)?Give suitable example.

## Replies

### Reply by Aryan Kumar

In Python, a dictionary is a data structure that stores a collection of key-value pairs, where each key maps to a specific value. It is also known as an associative array, hash map, or simply a map.

Dictionaries in Python are created using curly braces **{}** with key-value pairs separated by colons **:**

You can access the values in a dictionary using their keys. For example, to get the age of "Alice", you can use the following code:

```python
ages = {'Alice': 25, 'Bob': 30, 'Charlie': 35}
print(ages['Alice'])  # Output: 25
```

Dictionaries in Python are very versatile and can be used in a wide range of applications, such as data analysis, machine learning, and web development.

### Reply by Krishnapriya Rajeev

**Dictionaries** in Python are used to store data values in a **key: value pair;** this is unlike other data types that can hold only single values as an element. It contains ordered mutable and non-duplicate values.

We can create a dictionary in Python as follows:

```python
dict1 = {
"name": "Jacob",
"age": 30,
"place": "Kerala",
"job": "Teacher"
}
```

The values stored in a dictionary can be of any data type, and can also be duplicated. The keys, however, cannot be duplicated and must be immutable. The keys are also case-sensitive

We can add elements to a dictionary by using a new index key and assigning the required value to it.

```python
dict1["nationality"] = "UK"
```

To update the items within a dictionary, we can use the **update()** method. If the item does not exist in the dictionary, it will be added.

```python
dict1.update({"age": 28})
```


---

Original Source: https://www.mindstick.com/forum/157622/what-is-meant-by-dictionary-in-python-give-suitable-example

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
