PA Designer Learn 4: More Python Commands

1. Making Decisions

We all have to make decisions in life. For instance, imagine you were about to go outside. If it were raining you would take an umbrella with you, wouldn’t you? You’ve just made a decision!

Your robot is no different. It will have to decide when to stop listening for the bell and turn the light on. The way it makes decisions is with conditional statements. In Python code , these take the following form:

if condition:
    action

Don’t forget the colon after the condition and indentation of the action code. Both are important!