use iEP.
I need completed code that I can use.
or you can just give me a doc file.
ISTA
1
30: Homework 2
Due June 5 before class
1 Debugging
Today’s homework deals with debugging. This is the process that occurs when you find out your
code doesn’t work, and you try to figure out why.
Download the file errors.py from D2L. This file contains a script with a number of errors in
it. Some are programming language errors, which Python will report with error messages. Others
are logic errors – code that runs, but does not do what the programmer intended.
Your task is threefold:
1. Determine which lines have an error
2. In a comment after the line, write down the type of error message Python gives (if any), and
a brief description of why this line has a problem
3. Correct the error so that the program has the intended behavior
For example, if the line of code is:
99bottles = 5
Python will give the error:
File “
99bottles = 5
^
SyntaxError: invalid syntax
so the corrected line in your code should look like:
ninetyninebottles = 5 # SyntaxError: variable names can’t start with a number
If there are multiple errors of the same type in a row, you don’t have to put the same comment
for all of them; just comment the first and fix the rest.
The code has 15 problems by my count; each will be worth 1 point (15 pt.). Any additional
improvements to the code may be worth extra points (2 pt.).
2 What to turn in
Submit your corrected errors.py script to the Homework 2 Dropbox folder in D2L:
Total Points: 15 points possible
Extra Credit: 2 points possible
1