Skip to main content

Posts

Showing posts with the label Nested_Dictionaries_in_Python

Dictionaries in Python

Welcome to the Third Blog 👇 Dictionaries in Python: myDict={"name":"abbas","age":24,"gender":"male"} In Python, dictionaries are a powerful data structure that allows you to store and manipulate data in a key-value pair format. They are incredibly versatile and commonly used in various programming tasks.   Adding and Modifying Items To add a new item to a dictionary, we can simply assign a value to a new key. For example, we can add an email to a dictionary like this: ``` myDict["email"]="abbasjkdj@gmail.com" ``` This will add the key "email" with the corresponding value to the dictionary. Similarly, to modify an existing key's value, we can directly reassign a new value, such as changing the age like this: ``` myDict["age"]=29 ``` We can then see the updated dictionary with the modified values. Accessing Items Accessing items in a dictionary is straightforward. By using the key, we can retri...