If Statements
If Statements
If condition:
Statements executed if condition is true
Statements executed if condition is not or no
longer true.
and
Returns True if both conditions are
True.
E.g. Grade P is only printed if and only if
o mark>=45 and mark<55.
or
Returns True if at least one of the
conditions is True.
E.g. prints ‘Invalid entry’ if;
o either mark > 100 or
o mark < 0
not
Returns True if the condition is NOT
met.
E.g,