Problem Solving and Python Programming: UNIT III: Control Flow, Functions, Strings

Boolean Values

Python Programming

• There are two types of boolean values – true or false. • The boolean expression can be represented using the operator. For example

Boolean Values

• There are two types of boolean values – true or false.

• The boolean expression can be represented using the operator. For example

>>> 3= = 3

True

>>> 3= = 5

False

>>>

• In above example, = = operator is used for obtaining the boolean value of the expression.

• We can also check the data type of True and False with the help of type function

>>> type(True)

< class 'bool'>

>>> type(False)

< class 'bool' >

• Some of the valid boolean expressions are :

>>> True True >>> 5= =4 False >>> 3+2= =5 True >>>

 

Problem Solving and Python Programming: UNIT III: Control Flow, Functions, Strings : Tag: Engineering Python : Python Programming - Boolean Values