Page 11 - Touchcode_C8_Flipbook
P. 11
if a>b:
print (“a is greater than b”)
elif a==b:
print (“a is equal to b”)
else:
print (“a is less than b”)
Explanation: In this, you are comparing the values of two variables by using a comparison
operator. In the first statement it checks if a is greater than b, if this condition is true then
it prints “a is greater than b”, and if the condition is false, then “elif” block will execute and
checks if a is equal to b, if it is true, then it prints “a is equal to b” and if it is false then it prints
“a is less than b”.
Coding uiz 01 Critical Thinking
State whether the following statements are true (T) or false (F).
a. Control structure is a basic decision-making process.
b. Selection statement executes a set of statements for a certain number
of times.
Coding fact
Alan Turing, the father of modern computer science was famous for
developing the first modern computer.
LOGICAL OPERATORS
Logical operators are the fundamental blocks which are used to implement a decision-making
capability in the code. When you need to make decision based on two or more checks, it is
necessary to have a combination of logical operators.
Logical operators work like Boolean variables and return either TRUE or FALSE.
The three most important logical operators are:
AND Operator
It is used to see if two or more conditions are TRUE.
If all the conditions are true, the AND operator returns TRUE.
Conditionals in Details 9

