...
Constant Floating-point value
Value | Python Expression |
---|---|
Hexa decimal a1 | 0xa1 |
3.2e-12 | |
|
|
Basic Operators
Python Arithmetic Operators
...
Code Block |
---|
a = ["Jake", "John", "Eric"] b = ["John", "Jill"] print(set(a).difference(set(b))) |
Dictionary
Info |
---|
Python dictionaries are similar to lists in that they are mutable and can be nested to any arbitrary depth (constrained only by available memory). A dictionary can contain any type of Python object, including another dictionary. The keys in a given dictionary do not need to be the same type as one another, nor do the values. Dictionary elements are accessed by key. Unlike with list indexing, the order of the items in a dictionary plays no role in how the items are accessed. Even though dictionary access does not rely on item order, as of version 3.7 the Python language specification does guarantee that the order of items in a dictionary is maintained once the dictionary is created Keys are unique within a dictionary while values may not be. The values of a dictionary can be of any type, but the keys must be of an immutable data type such as strings, numbers, or tuples. |
Code Block |
---|
dict = {'Name': 'Zara', 'Age': 7, 'Class': 'First'} |
...