Dictionary is an unordered situated of key and worth pair. It is a holder that contains information, encased inside wavy props. The pair i.e., key and quality is known as thing. The key went in the thing must be special. The key and the quality are isolated by a colon (:). This pair is known as thing. Things are isolated from one another by a comma (,). Diverse things are encased inside of a wavy support and this structures Dictionary.
Key must be one of a kind and changeless. Quality is gotten to by key. Worth can be redesigned while key can't be changed. Word reference is known as Associative exhibit subsequent to the Key functions as Index and they are chosen by the client.
Python Dictionary supports the following Functions:
|len(dictionary)||Gives number of items in a dictionary.|
|cmp(dictionary1,dictionary2)||Compares the two dictionaries.|
|str(dictionary)||Gives the string representation of a string.|
|keys()||Return all the keys element of a dictionary.|
|values()||Return all the values element of a dictionary.|
|items()||Return all the items(key-value pair) of a dictionary.|
|update(dictionary2)||It is used to add items of dictionary2 to first dictionary.|
|clear()||It is used to remove all items of a dictionary. It returns an empty dictionary.|
|fromkeys(sequence,value1)/ fromkeys(sequence)||It is used to create a new dictionary from the sequence where sequence elements forms the key and all keys share the values ?value1?. In case value1 is not give, it set the values of keys to be none.|
|copy()||It returns an ordered copy of the data.|
|has_key(key)||It returns a boolean value. True in case if key is present in the dictionary ,else false.|
|get(key)||Returns the value of the given key. If key is not present it returns none.|