StudyToCert

All certifications / PCEP / Lessons

PCEP – Certified Entry-Level Python Programmer PCEP-30-02 · Domain 1: Computer programming and Python fundamentals

Boolean and relational operators, float accuracy and rounding surprises

▶ Watch the overview video

Last reviewed September 30, 2026 · Leer en español

Relational (comparison) operators compare two values and return a Boolean: == equal, != not equal, < less than, > greater than, <= less than or equal, and >= greater than or equal. Note that = assigns while == compares. Numbers of different types compare by value, so 1 == 1.0 is True and True == 1 is also True. Strings compare character by character using their character codes, so "B" < "a" is True because uppercase letters come before lowercase ones, and "apple" < "apricot" is True because p comes before r at the first difference. Comparing a string with a number using < raises TypeError, although == simply returns False.

Free account

Keep reading for free

Create a free StudyToCert account to read the rest of this lesson: 7 more sections, 6 key terms, a real-world example, an exam tip and self-check questions. Every lesson, lab and practice test is free with an account.

Sign up free Log in

Study PCEP for free
A week-by-week plan with every lesson, quizzes, checkpoint tests, a practice exam and hands-on labs.
Open the PCEP study plan