Python Dictionary Functions

Dictionary Functions

Dictionary in Python has many inbuilt functions.

Consider a dictionary:

CODE/PROGRAM/EXAMPLE
crew_details={
	  "Pilot":"John",
	  "Co-pilot":"Jem",
	  "Head-Strewardess":"Mini",
	  "Stewardess":"Jerry"
	  }
Function Output Explanation
crew_details.get("Pilot") John Returns the value for given key. If the given key is not found, returns None
crew_details.update({"Flight Attendant":"Jane", "Co-pilot":"Henry"}) No output, dictionary will be updated Updates the dictionary with the given key-value pairs. If a key-value pair is already existing, it will be overwritten, otherwise it will be added to the dictionary
#dictionary_functions_in_python #python_dictionary_functions #python_dict_function #python_enumerate_dictionary

(New page will open, for Comment)

Not yet commented...