Wednesday, January 17, 2018

Dictionary in Python


  • Created by using bracket
  • Key value pairs
  • Each key is separated from its value by a colon (:), the items are separated by commas, and the whole thing is enclosed in curly braces
  • Do not have any  order
Accessing Values in Dictionary
To access dictionary elements, you can use the familiar square brackets along with the key to obtain its value. 
#!/usr/bin/python3

dict = {'Name': 'Zara', 'Age': 7, 'Class': 'First'}
print ("dict['Name']: ", dict['Name'])
print ("dict['Age']: ", dict['Age'])



Results
dict['Name']:  Zara
dict['Age']:  7

Snapshot of some examples of Dictionary

8 comments:

  1. Aside from these aptitudes, the information researcher has business sharpness, relational abilities, advancement, and critical thinking capacity.data science course in pune

    ReplyDelete
  2. Great post i must say and thanks for the information.
    data science course

    ReplyDelete
  3. This may not come as uplifting news. Assessing worker fulfillment and execution through AI calculations? machine learning course

    ReplyDelete
  4. Attend The Machine Learning course in Bangalore From ExcelR. Practical Machine Learning course in Bangalore Sessions With Assured Placement Support From Experienced Faculty. ExcelR Offers The Machine Learning course in Bangalore.
    Machine Learning course in Bangalore

    ReplyDelete
  5. Thank you so much for helping me out to find the Data analytics course in Mumbai Organisations and introducing reputed stalwarts in the industry dealing with data analyzing & assorting it in a structured and precise manner. Keep up the good work. Looking forward to view more from you.

    ReplyDelete
  6. Such a very useful article. I have learn some new information.thanks for sharing.
    data scientist course in mumbai

    ReplyDelete