Equals or not
As you dive more into programming, you'll find that you start having dynamic variables where you don't necessarily know what they are at a given moment in your program. The equals/not equals operators help you determine if a variable is what it needs to be for something to happen.
Reminder: If there is only one equals sign =
as the operator, it's storing information in a variable. If there are two equals signs ==
, it is checking if the left side and right side match. If it is !=
, it is checking if the left and right side do not match.
When checking for equality, it will give you a boolean answer (True or False). Follow the comments to complete the code.
Solution 1
weather = "sunny"
count = 4
# Replace the ? with the equality operator to check if weather is equal to "sunny"
is_it_sunny = weather == "sunny"
# Finish the code to check if the variable count equals 5
is_count_5 = count == 5
# Use not equals operator to check if weather is not equal to "rainy"
is_it_not_rainy = weather != "rainy"