We've moved away from repl.it for coding exercises. Check out the new exercises on Coding Rooms with automated submissions.
Login to your Udemy course and head over to lesson 9 to get the sign up link: Click here
We've got some buggy code. Try running the code. The code will crash and give you an IndexError. This is because we're looking through the list of fruits
for an index that is out of range.
Use what you've learnt about exception handling to prevent the program from crashing. If the user enters something that is out of range just print a default output of "Fruit pie"
. e.g.
-
You'll need to catch the IndexError exception.
-
You'll need the try, except and else keywords.
Before checking the solution, try copy-pasting your code into this repl:
https://repl.it/@appbrewery/day-30-1-test-your-code
This repl includes my testing code that will check if your code meets this assignment's objectives.