Python Fundamentals


Syntax: Below is how we can define a dictionary:

d = {

	key: value,
	key: value,
	.
	.
	key: value
}

We can also create a dictionary using the dict() function which takes a sequence (list of tuples below for example) of key-value pairs:

d = dict([(key,value),(key,value),...,(key,value)])

Below are some useful dictionary operations: