Python allows you to run code if a certain condition is true, you can also use else and elif as well for alternate conditions. The following code is an example of conditionals. It is also important to note that == checks if two values are equal to each other while = assigns a value to a variable, there is also >, >=, <, <=, !=. All of these symbols are self explanatory except for != which mean not equal to, so if you had “if 1 != 2” then that would return true and the indented code would run.
var = input(“Please list your favorite color:\n”)
if var == “blue”:
print(“Blue is my favorite color as well, reminds me of the ocean”)
elif var == “red”:
print(“I see a lot of passion behind the color red”)
else:
print(“I love the color”, var, “as well”)