4. bool
Ex:
a=True
b=False
c=true # Error because it is not bool data type and we gave lower case letter 't'
d=false #Error because we gave lower case letter 'f'
type(a) # Find the type of a
output:
<class 'bool'>
We can use this data type to represent Boolean (True/False) values. It only allows True or False
Internally Python stores True as 1 and False as 0 (Zero) in the memory.
Example:
b=True
type(b)->bool
Ex2:
a=10
b=20
c=a>b
print(c)
"""output"""
False
5. None Data type:
Where do we use None data type?
If the value is not available, then to handle such type of situation None is used.
Example program on None
def ex():
a=10
print(ex())
None
Youtube channel click here to see this video
Next Topic: None data type
Previous Topic: Python Numbers
No comments:
Post a Comment