Module 2
Common conditional mistakes
Errors to watch out for.
Three common mistakes
Here are three mistakes that beginners often make with conditions.
PythonThree common mistakes.
# Mistake 1: using = instead of ==
# if x = 5: ERROR
# Mistake 2: forgetting the colon
# if x == 5 ERROR
# Mistake 3: wrong indentation
# if x == 5:
# print("yes") ERROR→
A common mistake
Using = instead of ==, forgetting the colon, and wrong indentation are the three most common conditional errors.
What is wrong with: if x = 5: