Beginner Python Concepts


Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content

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
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content