Skip to main content

Using Python Conditionals

Hands-On Lab


Photo of

Training Architect





The majority of programs that we write will need to be more than a single sequential path of execution. We usually work with data that isn't always the same, and occasionally requires us to do different things based on that data. To achieve this we need to utilize conditionals. In this hands-on lab, we'll work through the conditional logic for the popular interviewing Fizz-Buzz problem by creating a script that will prompt the user for a number and then print out either the number, "Fizz", "Buzz", or "FizzBuzz" depending on whether the number meets one of the Fizz-Buzz requirements.

To feel comfortable completing this lab you'll want to know how to do the following:

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.