From the course: Programming Foundations: Beyond the Fundamentals
Challenge: Debugging - Python Tutorial
From the course: Programming Foundations: Beyond the Fundamentals
Challenge: Debugging
(lively music) - Ready for another challenge? Now that you're familiar with the basics of debugging, try your hand at finding and fixing basic errors in some Python code. The start file for this video is supposed to recommend a house plant based on the level of care the user can give: low, medium, or high but when I run it, I can see that it's not working. Here's a hint. This code contains a syntax error, a runtime error and a logic error. Remember, you can use both your IDE and the terminal output to identify where the interpreter encounters each error. We talked about how debugging can be challenging so if you get stuck, consider trying a trick that many developers are fond of. Explain your code to a rubber duck. When I type one of three keywords, the program should recommend a house plant but it's not returning anything. Maybe I need to look at those if and elif statements and look for possible errors there. It's super common to find that explaining the problem to a colleague, a friend or even an inanimate object like a rubber duck can help you think about it in a different way and perhaps help you notice something to try or check. This challenge should take you about 10 to 15 minutes. Join me in the next video and I'll walk you through how I approached it. Have fun. (duck squeaking)