Tagged: if-else
Everything tagged "if-else", newest first.
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 #19: Loyalty Bonus
A beginner Python debugging exercise on if and else — why two separate if statements can both run when the first one changes the variable the second one checks, and how to fix it.
Python Coding Exercise #14: Soup or No Soup
A beginner Python exercise on if/else with strings — ask for a name, skip the order for one particular customer, and work out the total cost for everyone else without floating-point surprises.
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.
Python Coding Exercise #12: Students in Groups
A beginner Python exercise on integer division, the remainder operator and if/else — work out how many groups a class needs when the students don't divide evenly.