Advertisement
sissou123

Untitled

Mar 16th, 2022
1,027
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.86 KB | None | 0 0
  1. How to Create a Dictionary in Python
  2. Dictionaries are made up of key and value pairs nested in curly brackets. Here's an example of a Dictionary:
  3.  
  4. devBio = {
  5.  "name": "Ihechikara",
  6.  "age": 120,
  7.  "language": "JavaScript"
  8. }
  9. print(devBio)
  10. # {'name': 'Ihechikara', 'age': 120, 'language': 'JavaScript'}
  11. In the code above, we created a dictionary called devBio with information about a developer – the developer's age is quite overwhelming.
  12.  
  13. Each key in the dictionary – name, age and language – has a corresponding value. A comma separates each key and value pair from another. Omitting the comma throws an error your way.
  14.  
  15. Before we dive into how we can add items to our dictionaries, let's have a look at some of the features of a dictionary. This will help you easily distinguish them from other data structures in Python.
  16. FOR MORE:https://usdshort.com/WxSZzdDq
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement