Python practice: Boolean Truth Testing & Comparisons
Chapter 5 · 8 questions · included in full access
Question 1 · easy
Check sales target threshold
Solve it in your browserGiven
sales = 85andtarget = 80, check ifsales >= targetand print the boolean result:Question 2 · easy
Equality vs assignment check
Solve it in your browserGiven
region = "North", print whetherregion == "North"on line 1, andregion == "South"on line 2:Question 3 · easy
Logical and operator
Solve it in your browserGiven
units = 25andtier = "Gold", check ifunits >= 20 and tier == "Gold". Print the boolean result:Question 4 · easy
Logical or operator
Solve it in your browserGiven
is_weekend = Falseandis_holiday = True, check ifis_weekend or is_holidayand print whether the office is closed:Question 5 · easy
Membership testing with in
Solve it in your browserGiven
approved = ["North", "South", "West"]anduser_region = "North", print whetheruser_region in approved:Question 6 · easy
Negative membership with not in
Solve it in your browserGiven
banned_skus = ["SKU-99", "SKU-00"]anditem = "SKU-42", verifyitem not in banned_skusand print the result:Question 7 · easy
Truthiness of empty strings and zero
Solve it in your browserPrint
bool("")on line 1 andbool(0)on line 2 to demonstrate falsy values in Python:Question 8 · medium
Budget threshold verification
Solve it in your browserGiven
spent = 14500andbudget = 15000, printTrueifspent <= budget, otherwiseFalse:
These questions are part of full access.
The first chapters of every track are free. Full access is a one-time payment.
See pricing