13 Conditions
13 Conditions
•
Relational Operators
Identity operator: is
Membership Operator: in
Relational Operators
Relational Operators
Lexicographically ordered!!!
• Adding some logic
• The and keyword
• The or keyword
Boolean Expression • The not keyword
(Cont..)
•
• The general form of the IF statement is:
Chained Conditionals
Nested Conditionals
(Example)
• One condition nested within another
Nested Conditionals
(Example)
• Write a program to check if a number is positive
• Write a program to check if a number is positive or
negative
• Write a program to check if a number is positive or
Practice Question negative or zero.
• Guess the number !
Nested Conditionals
(Example)
• Provide a way to simplify nested conditionals