The help queue in lab can get long at times. While you are waiting
for assistance, you should try the following steps to make
progress towards figuring out the problem on your own. Even if you
don't resolve the problem, you will have gathered more information
that will help the Ninja or Instructor diagnose the issue.
- If you don't know where to start, go to the online book and
re-read the sections that relate to the current lab. While
reading, open up the python interpreter and try out examples of
the concepts you need to use in the lab. Also look back at the
examples that were done in class. The goal of every lab is to
reinforce the concepts that were covered in class. We will have
always covered the concept in class previously.
- If your program produces an error message, read the message
carefully. It will often include a line number. Open your
program in an editor and go to that line number. Look at both
the given line and the previous line and see how the message
relates to the code on those lines. Here are some examples:
- If your program executes, but produces the wrong answer, try to
add print statements throughout your program to track the
progress of the data as you read it in and process it. This is
often an effective way of pin pointing when the problem
occurred.
- If print statements are too painful, or confusing, using a debugger
like pudb may help.
See this page on how to use pudb.
A debugger will let you run your program one line at a time, allowing you to
see each variable as the program runs.