Back
Close

Beginner Python Concepts

a-Rye
25.7K views

Control Flow

Control Flow refers to the use of comparison logic to determine what to do next. By that, I mean using if, elif, else statements to filter what code to run based on certain conditions.

The test cases provided test some of the common "corner cases" you may want to test.

If and elif statements will execute if the expression equates to True or 1. If the expression evaluates down to any other value, the attached code won't execute.

Here are some examples of such:

You can also chain conditions in your if, elif, else statement blocks. This can be done with and, or, not, and xor.

Try changing the conditions
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io