Python Concepts ( Boolean & Dictionaries)

Boolean

The Python Boolean type is one of Python’s built-in data types. It’s used to represent the truth value of an expression. For example, the expression 1 <= 2 is True, while the expression 0 == 1 is False. Understanding how Python Boolean values behave is important to programming well in Python.

Bool data types are represented by True or False in python. Bool values are used to evaluate the value of an expression. Say 2 > 5 will result to False when executed in python.

Dictionaries

Dictionaries (dict) are unordered collections of unique values stored in (Key-Value) pairs. In a dictionary, duplicate keys are not allowed but duplicate values are allowed.
Dictionaries are heterogenous for both keys and pairs, but only hashable objects (str, int, tuples…) can be used as keys. A dictionary is mutable and it is unordered so indexing and slicing cannot be performed on it. An empty dictionary is represented by “{}”.

Scroll to Top