Tagged: conditionals
Everything tagged "conditionals", newest first.
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 #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.