Boolean in Python

What is a Boolean?

Ture or False (Make sure to use initial letter as a capital)

For Example,

>>> True

True
>>> true
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'true' is not defined


Examples:

>>> x= True
>>> type(x)
<class 'bool'>

>>> 9 > 8
True

>>> 8> 9
False 


How to define/assign a variable without value?

>>> x
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'x' is not defined

Here is the way, you could define the variable without defining/assigning the value
>>> x=None
>>> x


Comments

Popular posts from this blog

Tuples in Python

Auditing in Oracle database