top of page

Booleans and Conditions

This page features 3 levels of projects to teach you how to use Booleans in Python:

1. Simple True/False questions

2. Combining conditions with and, or, not

3. Advanced use of Boolean logic with loops

Level 1: Turn the Lights Off

Goal: Ask the user "Is it dark outside?" and depending on their answer, tell them to turn the lights on/off.

Topics: Booleans, input, if/else

Level 2: What's the Weather?

Goal: Ask the user about the weather, and tell them how to dress appropriately.

Topics: Booleans, input, if/elif/else, 

Level 3: Quiz Game

Goal: Ask the user some multiple-choice questions, check if their answers are correct using Booleans, and keep a score. For more advanced learners.

Topics: Lists, loops, booleans, len/input functions

Challenge Questions

Level 1: 

What if the user doesn't give a valid answer (not yes/no)? Add code to fix this.

Add a second condition: "Is someone in the room?"

Level 2: 

Handle cases when the user's answer is invalid.

Add another condition: "Is it snowing?"

Level 3: 

Add feedback: show the percentage score, congratulate the user if they got a perfect score.

Add a bonus question at the end if the user got everything right.

bottom of page