New course! Every coder should learn Generative AI!
Try a free lesson+ 7
As in the official documentation of python 3.7.4 written, None is a Built-in Constant with the definition:
None¶
The sole value of the type NoneType. None is frequently used to represent the absence of a value, as when default arguments are not passed to a function. Assignments to None are illegal and raise a SyntaxError.
+ 5
None is a kind of data that represents something that has no type.
For example
X = print("hi")
print(X);
The output is -
hi
None
Bcoz, the first print statement prints "Hi" and returns None which indicates nothing. The second print statement prints that None .
Got it?
+ 1
any_variable=print("hello world")
here the print() doesn't return any value
that's why tha variable 'any_variable' becomes None type...
you can check it by simply write
type(any_variable)