Editor

Validate a String Length

Beginner · Write the code · 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 lesson

Create a variable word set to "Python". Check if the string is non-empty AND longer than 3 characters. Print the result.

Expected output:

True
# Create word and check if it's non-empty AND longer than 3 characters

More booleans and operators exercises

All Python exercises · 50 practice problems · Python Fundamentals quiz