Tagged: comparison-operators
Everything tagged "comparison-operators", newest first.
Python Coding Exercise #38: Grades and Points
A beginner Python exercise on if, elif and else with ranges — turn a table of point boundaries into a grade, handle impossible values, and see two ways to write the conditions.
Python Coding Exercise #36: Age Check
A beginner Python exercise on if, elif and else with three outcomes — respond to an age that is normal, too young, or impossible — and learn why the order of the conditions matters.
Python Coding Exercise #33: Greater Than or Equal To
A beginner Python exercise on if, elif and else — compare two numbers, print the greater one, and handle the case where they are equal.
Python Coding Exercise #32: Age of Maturity
A beginner Python exercise on if and else — decide whether someone is of age using 18 as the limit, and see why the boundary value 18 is the number to test.
Python Coding Exercise #20: What to Wear Tomorrow
A beginner Python exercise on comparison conditions — turn "over 20, 10 or 5 degrees" into the right if statements, learn how to pick between <, <=, > and >=, and practise with boundary values.
Python Coding Exercise #15: Order of Magnitude
A beginner Python exercise on separate if statements — print every "smaller than" message that applies to a number, and see why using elif here would give the wrong output.
Python Coding Exercise #13: Simple if Statements
Two short beginner Python exercises on if statements and comparison operators — print "Orwell" only when the number is 1984, and calculate the absolute value of a number.