← Courses

Python for AI — Beginner Foundations

Data Science

Data Types · Lesson 31 of 76

Booleans

A boolean is either True or False. They come from questions and drive decisions.

Python

Combine them with and (both must be true), or (at least one), and not (flip it):

Python

Booleans are what if statements check to decide what to do next.

Your turn: set score = 80 and print whether it's >= 50 and <= 100.

Check your understanding

Exercise — check your understanding

Set can_vote to whether age is 18 or more.

You’re reading for free. Sign in to keep your progress and earn a certificate when you finish.Sign in to keep my progress →