Python Programming

Python Programing -small way to learn programming

Dictionary

Dictionary

A dictionary is a collection which is unordered, changeable and indexed. In Python dictionaries are written with curly brackets, and they have keys and values.


Example

Create and print a dictionary:

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

Accessing Items

You can access the items of a dictionary by referring to its key name, inside square brackets:

Example

Get the value of the "model" key:

x = dict["model"]
print(x)
Now output
Mustang

SHARE

Milan Tomic

Hi. I’m Designer of Blog Magic. I’m CEO/Founder of ThemeXpose. I’m Creative Art Director, Web Designer, UI/UX Designer, Interaction Designer, Industrial Designer, Web Developer, Business Enthusiast, StartUp Enthusiast, Speaker, Writer and Photographer. Inspired to make things looks better.

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment

XI IP CHAPTER WISE LIST

  XI IP  CHAPTER WISE LIST   Sn   Chapter Name   Drive Link (Lesson Notes) 1 Comp...