Python 101 – Dealing With Input Errors, Loops, Lists, & Debugging

February 7, 2024

Kaur Hendrikson fixes the errors from Part 1. Then he adds complexity, teaching more foundational Python concepts, as we skill up.


Series

Part 2 – Error handling, using loops, and if/else/elif statements

In this Insight, we tackle the problem we left off in the last Insight – an error that occurs upon entering something other than a valid integer. After solving that, we add support for more than two numbers and a choice between adding and multiplying them.

In tackling the above problems, you’ll learn how to troubleshoot – and build your code – by writing down what you’re trying to accomplish. Using plain language comments to describe your intentions adds great clarity to the code you’ll be writing. And if anyone needs to read your code in the future, it makes it easy for them to understand your intentions.

Key takeaways from this Insight

By the end of this Insight, you should understand:

  • Handling errors with try & except
  • Using while loops
  • Using for loops
  • Using break for getting out of loops
  • Defining a list of indeterminate length, and ‘appending’ to the list
  • Using try, except
  • Using range to determine the size of the list
  • Use conditionals if, else, and elif
  • Give the user options after inputting data
  • Debug errors in our code and use Print to check our code as we work
  • A significant limitation of Code Editor software error-checking

Questions or Comments?

How did I do with this Insight? Are you able to follow along Let me know! I’m recording this tutorial series one at a time, after I see your feedback. If you need anything clarified or have an idea for code you’d like us to build together, use the comments! If you would rather I speed things up and record a few Insights at a time, I’m also open to the idea of getting through this series in a shorter time.

– Kaur

Member Content

Sorry... the rest of this content is for members only. You'll need to login or Join Now to continue (we hope you do!).

Need more information about our memberships? Click to learn more.

Membership options
Member Login

Are you using our app? For the best experience, please login using the app's launch screen


1,200+ Tutorials, Articles, and Webinars To Explore

Get 7-day access to our library of over 1,200+ tutorials - for $5!
Do you like what you see? Maintain access for less than $5 per month.


Start Your Test Drive!
Loading...