Dictionary is used to store elements in variable using key:value pairs.
Curly braces {} are used to define a dictionary.
Dictionary stores different-different data type value like int,float,string,list,tuple,etc.
A dictionary is a collection which is changale and do not allow duplicate key.
Syntax
dictionary_name = {key:value,key:value}
len() function used to get dictionary length. If you want to know how many items in a dictionary then you can use len() function. len() function very useful when you write logic in your program.
type() function used to get data type of dictionary.
Write dictionary key name inside square brackets to get an item of dictionary. get() method is also used to get an item from dictionary.
Comsysapp.com is an educational website. Students and software developers can learn programming language tutorials. Comsysapp is very useful for beginners and professional developers. Comsysapp provides tutorial in easy language. Comsysapp.com has focus on simplicity.
Comsysapp.com provides free tutorials like c, html, css, etc. All tutorials are free for beginner and professionals.
comsysapp.com is not responsible for any mistake. We are not responsible if information made available on our website is incomplete or invalid. But comsysapp.com always try for zero-zero mistake.
comsysapp.com does not collect any data from users. We use Google AdSense advertising on our website. We never ask personal or private information.
copyright © 2023