The Anubhav portal was launched in March 2015 at the behest of the Hon'ble Prime Minister for retiring government officials to leave a record of their experiences while in Govt service .
In Python, None is a special constant that represents the
absence of a value or no value at all. It’s a built-in object of type
NoneType and is often used as a placeholder when a variable, function, or object doesn’t have a meaningful value yet.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
Basic Facts about
NoneNoneTypeNoneFalsein a Boolean contextExamples
1. Assigning
Noneto a variable2. Default function return value
If a function doesn’t explicitly return anything, it returns
Noneby default:3. As a placeholder for uninitialized variables
4. Testing for
NoneAlways use
isoris not(not==or!=) to compare withNone:Nonein Function ArgumentsYou can use
Noneas a default argument value to represent “no input provided.”Boolean Context
Nonebehaves likeFalsein conditions:Nonevs0,False,'',[],{}NoneFalse0FalseFalseFalse''False[]False{}FalseEven though all these evaluate to
Falsein Boolean context, onlyNonerepresents “no value”.Summary
Noneis Python’s equivalent of “null” or “no value.”NoneType(singleton).is/is not.