## Exercise 8: HELP ME

This week we'll be doing something a bit different - rather than writing your own code, you'll be helping to debug (fix) my code!

• bugs.txt - a text file containing at least 8 lines from the provided code file and descriptions of the errors present in them, as well as a 1-2 sentence description of what the program does (header comment). This part may be completed in pairs if you wish.
• Lists & Dictionaries practice - on Learn@UW. This part should be completed individually.
• Review questions - this part will not be graded, but we will be talking about them in class on 3/30 and they will help you prepare for the exam, so you may want to work through them.

### Lists and dictionaries "Quiz"

This week we'll have a brief problem set (only 3 questions this time) with some problems using lists and dictionaries. It's available under Quizzes on Learn@UW.

You will have two attempts on this quiz — I recommend trying the first time with paper and pencil. You are welcome to use the interpreter and LiClipse to check your work on the second attempt.

### Code Background

My code doesn't work. Help me fix it.

I want to use dictionaries for translating sentences into a number code (each letter becomes the corresponding number: a=1, b=2, etc.) and back. Case (upper vs lower) shouldn't matter.

There are at least 10 lines with one or more errors on them; some are syntax errors, some are logic errors. Find at least 8 errors, describe the error and how you might fix it.

### bugs.txt

In order to help me fix my code effectively, your bugs.txt file should contain lines like this, pointing out the code line which contains the error, what the error is, and how to fix it:

```Line 1: print hello world
Bug: Right now Python thinks hello and world are variables. Add quotes to make it a string.
Fix: print 'hello world'

Line 4: x += 5
Bug: NameError, x was never initialized.
Fix: add x = 0 somewhere before line 4
```

You should have at least 8 of these, but there are definitely more than 8 bugs in this code!