Predict the Logical Output
Beginner · Predict the output · from Python Booleans, Comparisons, and All Operators Explained
From the lesson: Python Booleans, Comparisons, and All Operators Explained
Every day you make yes-or-no decisions. "Is it raining?" "Do I have enough money?" "Is my password correct?" Computers make the same kind of decisions, and they use booleans to do it.
Read the lessonWithout running the code, predict what each line will print. Then run it to check your answers.
The code prints the results of three logical operations.
print(True and False)
print(True or False)
print(not True)
More booleans and operators exercises
- Check if a Number Is in RangeBeginner
- Validate a String LengthBeginner
- Fix the Comparison BugBeginner
- Check for a Leap YearBeginner
- Evaluate Truthiness with bool()Beginner
All Python exercises · 50 practice problems · Python Fundamentals quiz