Menu
Coddy logo textTech

Equals Operations

Lesson 14 of 28 in Coddy's Clean Code - Write better code using Python course.

Using not and is keywords is a good practice when comparing with True, False or None.

if value1:
	print("value1 is truthy!")

if not value2:
	print("value2 is falsey!")

if value3 is None:
	print("value3 is None!")

if value4 is not None:
	print("value4 is not None!")

The alternatives of using == and != is not the Pythonic way!

Try it yourself

This lesson doesn't include a code challenge.

All lessons in Clean Code - Write better code using Python