Skip to content

Joseph-T-Gordon

A complete log of all recent projects and skills

Menu
  • About me
  • Posts/Projects
  • Resume/Certifications
Menu

Post #46 (Python Programming) – Dictionaries within Python

Posted on June 18, 2023June 26, 2023 by admin

Today I will be talking about dictionaries in python. Dictionaries use a key-value pair. For example I need the phone number of my friend Bob, I look up the name Bob and there’s his number. This is a good example of what dictionaries are used for but what do they look like?

Ex:

Dictionary = {“Dog”: “Puppy”, “Cat”: “Kitten”, “Duck”: “Duckling”}

print(Dictionary)

print(Dictionary[“Duck”])

Result:

{“Dog”: “Puppy”, “Cat”: “Kitten”, “Duck”: “Duckling”}

Duckling

Key-values pairs are separates by a colon and different pairs separated by comma. It doesn’t have to be string-string it can be string-integer, string-float, float-string, integer-integer, etc. You can print the entire dictionary or you can print a specific value by querying a key. As you can see from print(Dictionary[“Duck”]) I was able to print the value by utilizing its key.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

© 2025 Joseph-T-Gordon | Powered by Minimalist Blog WordPress Theme