Worked Examples · Example 5.7
Q.Example 5.7:
myVar = None
print(type(myVar))
<class 'NoneType'>
print(myVar)
None
myVar = None
print(type(myVar))
<class 'NoneType'>
print(myVar)
None
West Bengal WbchseTextbookSubjective· 2mImportance★★★★★est
27% · 13/49 Questions
You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.
Start your 14-day free trial to unlock the full solution →None is Python's dedicated "no value" object with its own type NoneType — the example prints <class 'NoneType'> and None.
The concept is the None type: Python provides one special object, None, to represent the absence of a value. It is the only value of its class, NoneType. Typical uses: a variable that will be filled in later, or the value returned by a function that has no explicit return.
>>> myVar = None
>>> print(type(myVar))
<class 'NoneType'>
>>> print(myVar)
None
Step by step:
myVar = None— the name myVar is bound to the unique None object. The variable exists (no NameError), but it deliberately holds "nothing".print(type(myVar))→<class 'NoneType'>— None's class.print(myVar)→None— printing the object shows the word None.
What None is not:
| Value | Meaning |
|---|---|
0 | a number |
"" | an empty string |
False | the boolean false value |
Unlock everything free for 14 days
- Full step-by-step solutions
- Concept-first explanations
- Methods, shortcuts & mistakes
- PYQ mapping + timed mock tests
Full access for 14 days. No credit card required.