Make sure you take the time to understand error messages. They can help you a lot.
print statements are your friends. Use them to help you uncover what is really happening in your code.
Work backward from the error. Many times an error message is caused by something that has happened before it in the program. Always remember that python evaluates a program top to bottom.