Keywordsin programming languages are specific words that are reserved to communicate specific things to the computer. These words remain consistent across all uses of the programming language.
Trueonly if both the operands are
Trueif any the operands are
TRUEif the value is present. Its secondary use is to traverse through a sequence in a
whileloop evaluates to
breakstatement is encountered.
NOTE: There can be as many
awaitkeywords within a function as needed.
TRUEif the objects are identical and
NOTE: It is an object with the datatype
NoneType. There cannot be multiple
Noneobjects but can assign it to variables which would be equal to one another.
Nonedoes NOT imply
0, or empty list/string/dict.
TypeError. To catch exceptions, use
try...exceptblocks are used to catch exceptions if they fail the
tryset of instructions.
try...exceptblocks are used to catch exceptions by trying out a set of instructions to see if an exception occur.
try...exceptstatements to close up resources or file streams. This ensures that the block of code inside it gets executed even if there is an unhandled exception.
NOTE: As a global variable, if we need to read the value of the variable we do not need to define it as global. If we need to modify the value of a global variable inside a function, then we must declare it with global, otherwise a local variable is created.
returnstatement, consisting of an expression that is evaluated and returned.
NOTE: If you need to modify a non-local variable inside a nested function, then we must declare it with
nonlocal. Otherwise a local variable with that name is created inside the nested function.
NOTE: If we do not return a value explicitly,
NONEis returned automatically.
NOTE: "Context Manager" is a class that implements
__exit__methods. Use of
withstatement ensures that the
__exit__method is called at the end of the nested block. Tis concept is similar to the use of
returnstatement, however it returns a generator.
NOTE: A Generator is an iterator that generates one item at a time. A large list of value will take up a lot of memory. Generators are useful in this situation as it generates only one value at a time instead of storing all the values in memory.
NOTE: If the assert condition is true, nothing will happen. But if the condition is false, the error -