Reading the message on a QR code is helpful, but only if you can use the information to make decisions! Do you remember the lesson on if statements? Now you are going to put it all together!
In the obstacle avoidance lesson, you learned how to use if statements to compare numbers. In this case, the message is a string of characters. Asking if “apple” is greater than “banana” doesn’t really make sense, but you might see if the two messages match, or are equal. In Python, checking if two values are equal looks like this:
if message == "apples":
# Do something here!
In this example, message is the variable. If the value inside the variable is exactly equal to “apples”, then the if statement will execute. And yes, you need the two equal signs!