Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set your subtitle preferences in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please refer to our video player troubleshooting guide for assistance.

Python Basics Exercises: Conditional Logic and Control Flow (Summary)

In this course, you practiced what you learned in Python Basics: Conditional Logic and Control Flow. You can now confidently compare values using comparison operators like <, >, <=, >=, !=, and ==. You’ve also accomplished a lot by building complex conditional statements using and, or, and not.

You also controlled the flow of your program using if statements. You created branches in your program using ifelse and ifelifelse. You also managed to control precisely how code is executed inside an if block using break and continue.

You got some experience with the tryexcept pattern to handle errors that may occur during runtime. This is an important construct that allows your programs to handle the unexpected gracefully and keep users happy that the program didn’t crash.

For more information on the concepts covered in this course, check out the following tutorials:

Or you can explore the following video courses:

To continue your Python learning journey, check out the other Python Basics courses. You might also consider getting yourself a copy of Python Basics: A Practical Introduction to Python 3.

Download

Sample Code (.zip)

3.8 KB
Download

Course Slides (.pdf)

5.3 MB

Steinar Martinussen on Nov. 19, 2023

I made this work with just conditional logic and flow. As the instructor was defining his own functions to not repeat himself, I felt I was missing some knowledge around those. Maybe we seen basic stuff of it so far, but not how to pass values, how the return statement work etc. So I made the whole thing work great, but still felt that I could’ve done better if there were more around defining own functions before in the learning path. However, I will find some info about this and dig into it myself since I’m now intrigued

Martin Breuss RP Team on Nov. 22, 2023

@Steinar Martinussen making it work with just conditional logic is perfectly fine! 😃👏

And thanks for the feedback that the functions and loops course from earlier in the learning path didn’t provide enough information or training to properly follow along with my refactoring here.

Become a Member to join the conversation.