Agenda1. Relational operators: >, <, <=, >=, ==, !=
2. The if-elif-else statement
3. Logical operators: and or not
3.1 The if Statement
Program Output
Indentation: Whitespace Matters!1 tab = 4 spaces
Indentation examples
3.2 The if-else Statement
if-else statement
Program output
if-else statement w boolean
if-else statement w boolean, version 2
3.3 String comparison
Program output
String comparison is case sensitive
Program Output
3.5 Logical Operators
Operator Description
and will return true when both conditions are true.
or will return true when at least one condition is true.
not If the condition is true, not operator will make it false.
Logical and
Program output
Logical or
Program output
Operator not
Program output
3.4 The if-elif-else Statement
Testing a series of conditions
Age:infant, child, teenager, adult. Write a program that asks a user to enter a person’s age. The program should then display a message if the person is an infant, child, teenager or adult.
Solution -where’s the bug?
3.4 Nested if-elif-else statements