condition
An expression that is tested for being true or false, such as weight > 50, to decide what a program does next.
In more detail
Conditions appear in if, elif and while headings. They are usually comparisons joined with and, or and not, but any value can serve because Python judges its truthiness.
Related terms
- Boolean — A value that can only be true or false.
- if statement — A statement that runs a block of code only when a condition holds, optionally with an else block for when it does not.
- while loop — A loop that keeps repeating its block as long as a condition stays true, checking the condition before each pass.
- comparison operator — An operator that compares two values and gives true or false, such as equal, not equal, less than or greater than.
Taught in
- Your Python Folder And A First Program — Hands-on Python: Complete Video Course & Book
- Variables And Assignment — Hands-on Python: Complete Video Course & Book
- Split And Join — Hands-on Python: Complete Video Course & Book
- Conditions And Simple If Statements — Hands-on Python: Complete Video Course & Book
- Compound Boolean Expressions — Hands-on Python: Complete Video Course & Book
- Chapter Three In One Sitting — Hands-on Python: Complete Video Course & Book
- Forty Minutes, Thirty Items: How PCEP Is Run — PCEP Certified Entry-Level Python Programmer (PCEP-30-02) Exam Prep
- Branching With If, Elif And Else — PCEP Certified Entry-Level Python Programmer (PCEP-30-02) Exam Prep
- Conditions The Exam Loves — PCEP Certified Entry-Level Python Programmer (PCEP-30-02) Exam Prep
- While, For, Range And The Loop Else — PCEP Certified Entry-Level Python Programmer (PCEP-30-02) Exam Prep
- Control Flow Sprint — PCEP Certified Entry-Level Python Programmer (PCEP-30-02) Exam Prep
- Lists: Slices, Methods And Aliases — PCEP Certified Entry-Level Python Programmer (PCEP-30-02) Exam Prep
- Twelve Traps, One Shape Each — PCEP Certified Entry-Level Python Programmer (PCEP-30-02) Exam Prep
- Mock, Review And Exam Day — PCEP Certified Entry-Level Python Programmer (PCEP-30-02) Exam Prep
- Handlers, args, raise And assert — PCAP Certified Associate in Python Programming (PCAP-31-03) Exam Prep