Start free

Browse › Introductory Python

Create Branching Logic in Python

Guided

Part of Introductory Python Topic: Programming

Access

StationX Infrastructure Labs — 3 attempts per lab

🔒 Add StationX Infrastructure Labs — $149 / year · 3 attempts per lab

Already have access? Sign in.

New to this? Try a free practice lab — a scripted hacking challenge in your browser, no account needed.

What you'll do

In this lab, you will create branching logic in Python.

  1. Define an if statement that evaluates whether a number is even or odd by using the modulo operator
  2. Generate different outcomes based on the result of the evaluation
  3. Determine whether a value is part of a list by using an if else statement
  4. Return different values based on the evaluation of the conditions in the if else statement
  5. Evaluate a condition in an if statement by using the logical and operator
  6. Evaluate a different condition in an if statement by using the logical or operator

Note: Once you begin the lab, you will not be able to pause, save, or exit and then return to your lab. Please ensure that you have set aside enough time to complete the lab before you start.

  • ⏱ About 45 minutes
  • Counts towards: Introduction to Python

Roadmaps that use this lab