bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

Learn/Python/Foundations
Python•Foundations

Python Comparison Operators

Flash cards

Review the key moves

1/4
Core idea

What is the main idea behind Python Comparison Operators?

Lesson checks

Practice each idea before moving on

Short Mimo-style checks built from this lesson's code, terms, and sequence.

1Quick choice

Which statement best captures the main point of this lesson?

2Fill blank

Complete the missing token from the example code.

___(1 < x < 10)
3Order

Put the learning moves in the order that makes the concept easiest to apply.

Comparison operators are used to compare two values:
Chaining Comparison Operators
Comparison Operators

Comparison Operators

Comparison operators are used to compare two values:

OperatorNameExample
==Equalx == y
!=Not equalx != y
>Greater thanx > y
<Less thanx < y
>=Greater than or equal tox >= y
<=Less than or equal tox <= y

Chaining Comparison Operators

Python allows you to chain comparison operators:

Example

x = 5

print(1 < x < 10)

print(1 < x and x < 10)

Previous

Python Assignment Operators

Next

Python Logical Operators