Quizz
The full text of this chapter, to read or revisit. To practise, do the exercises.
▶ Do the exercisesExercise 1 — AND Basics
How many values need to be True for and to return True?
Hint : AND requires ALL conditions to be True to return True.
Exercise 2 — OR Basics
What does False or False or False return?
FalseTrueErrorNoneHint : OR returns False only when ALL values are False.
Exercise 3 — NOT Effect
What is the result of not not not True?
FalseTrueErrorNoneHint : NOT returns the opposite of a boolean value. Double NOT brings you back to the original value.
Exercise 4 — Equality Check
What does 5 == 5 return?
TrueFalse5ErrorHint : The == operator checks if two values are equal and returns a boolean.
Exercise 5 — Operator Symbols
Match each operator with its meaning:
==!=>=<=Exercise 6 — Basic Comparison
Complete the comparison to check if your Codémon's level is exactly 50:
Hint : == is used to check if two values are exactly equal. != checks if they are not equal.
Exercise 7 — Combined Expression
What is the result of True or False and False?
TrueFalseErrorNoneHint : AND has higher priority than OR. Take care of it first, then the OR.
Exercise 8 — Inequality Check
What does 10 != 20 return?
TrueFalse10ErrorHint : == is used to check if two values are exactly equal. != checks if they are not equal.
Exercise 9 — Battle Conditions
A Codémon can battle if its HP is more than zero. Complete:
Hint : > checks if a value is greater than another. >= checks if it's greater than or equal.
Exercise 10 — Parentheses Priority
What is the result of (True or False) and False?
FalseTrueErrorNoneHint : Parentheses are evaluated before AND, and AND before OR.
Exercise 11 — Comparison Results
Match each comparison with its result:
7 < 1015 > 208 >= 85 <= 3TrueFalseTrueFalseExercise 12 — Arena Entry
You can enter the arena if your level is at least 15 AND you have at least 5 badges:
Hint : Use >= for 'at least' (includes the value), and AND when both conditions are required.
Exercise 13 — NOT with Comparison
What is the result of not (5 > 10)?
TrueFalse5ErrorHint : Evaluate what's in parentheses first, then apply NOT.
Exercise 14 — Complex AND
What is the result of True and True and False and True?
FalseTrueErrorNoneHint : Compute it step by step. Remember with AND you need both sides to be True for it to be True.
Exercise 15 — Evolution Check
A Codémon evolves if its level is greater than 30 OR it has a special stone:
Hint : Greater than and greater than or equal to are different, pay attention!
Exercise 16 — Operator Behavior
Match each operator with when it returns True:
andornot==Exercise 17 — Range Check
What is the result of 10 <= 15 and 15 <= 20?
TrueFalse15ErrorHint : Compute each comparison first, then apply AND.
Exercise 18 — Status Check
A Codémon can train if it's NOT poisoned AND NOT paralyzed:
Hint : We need both sides to be True so he can train.
Exercise 19 — Mixed Operators
What is the result of not (True and False)?
TrueFalseErrorNoneHint : Evaluate what's in the parentheses first, then apply NOT.
Exercise 20 — Expression Evaluation
Match each expression with its result:
not (False or False)True and not FalseFalse or True and Falsenot True or not FalseTrueTrueFalseTrueExercise 21 — Item Check
Check if you have more than 10 potions OR exactly 5 revives:
Hint : > is for strictly greater than, >= is for greater than or equal to
Exercise 22 — Complex OR
What is the result of False or False or True or False?
TrueFalseErrorNoneHint : OR returns True if at least one value is True. Here, one value is True.
Exercise 23 — Tournament Entry
To enter, your level must be between 20 and 50 (inclusive) AND you must NOT be banned:
Hint : This is a subtile combination of comparisons and boolean operators, take 2 minutes and you will get it!
Exercise 24 — Comparison Chain
What is the result of 5 != 5?
FalseTrue5ErrorHint : The != operator checks if values are different.
Exercise 25 — Real Scenarios
Match each scenario with the correct expression:
hp > 0 and not sleepingtired or injuredlevel == 50age >= 18