![]() |
VOOZH | about |
None is a special keyword that represents the absence of a value. It is commonly used to indicate that a variable has no value assigned or that a function does not return anything explicitly.
None
Explanation: show() does not contain a return statement so, Python automatically returns None.
Although None, False, 0 and "" may all behave as false values in conditions, they represent different things in Python.
False False False
Explanation:
Example 1: The following example assigns None to a variable. This is often used to indicate that a variable currently has no value.
None <class 'NoneType'>
Explanation: x = None assigns the special value None to x and type(x) returns NoneType, which is the data type of None.
Example 2: The following example checks whether a variable contains None using the is operator.
No value assigned
Explanation:
Example 3: The following example uses None as a default parameter value when no argument is provided.
Hello, Guest Hello, Emma
Explanation: