Dictionary in Python - Tutorial

For Consultation : +91 9887575540

Stay Connected :

What is Dictionary

  • a built-in data structure available in Python
  • a dictionary is a sequence of key-value, or item, pairs separated by commas.
  • Ex

port = {22: “SSH”, 23: “Telnet” , 53: “DNS”, 80: “HTTP” }

  • . In a list, values are indexed by the range of numbers, but in a dictionary, values are indexed by keys.
  • Syntax

Dictionary_name = {key: value}

Key Features:

  • The key of the dictionary can not be changed
  • A string, int, or float can be used as a key
  • Keys are unique Values can be anything, for example, list, string, int, and so on
  • Values can be repeated Values can be changed


Select your currency