Python Dictionaries

What are Python Dictionaries

Python Dictionaries is used to store data value. Let’s see some exmples…

thisdict = {
  "brand": "Ford",
  "model": "Mustang",
  "year": 1964
}
print(thisdict)

we can print custom value for example let’s print brand

thisdict = {
  "brand": "hacktube",
  "model": "hacktube5",
  "year": 2022
}
print(thisdict["brand"])

Duplicate

Dictionaries can not store two item with same key

thisdict = {
  "brand": "hacktube",
  "model": "hacktube5",
  "year": 2022,
  "year": 2022
}
print(thisdict)

Leave a Reply