Introduction

One of the things which will help any student improve their coding is doing. The issue is that this can be rather abstract a lot of the time. For the more mathematically inclined project euler can be good. However this generally is cart before horse territory. If you can't write an if statement you can't ask questions. If you can't write a loop you can't repeat sections of code. And if you have no way of checking yourself, you have no way of finding out what you know.

Using these questions and what happens if I get stuck?

I would recommend starting at the beginning of the list and working your way down.

learn x in y minutes (Python3) is an excellent guide to the syntax of programming languages, including Python. Your first step when stuck should be here.

When starting out at programming it can be hard to understand why the computer is so strict.

I understand what I mean, why can't the silly computer!

Here's a checklist of things we can do.

  1. Have we written the instructions the computer expects? Check again a crib sheet such as learn x in y minutes (Python3).
  2. Check for spelling mistakes. print is not the same as pirnt.
  3. Are the variable names we use identical everywhere? Name, NAME, name are NOT the same thing!
  4. Have we closed all brackets we have opened?
  5. Make sure you're using a good text editor for coding. Tabs and spaces are not the same in python and you will confuse the computer. I would recommend using Pycharm or Jupyter.
  6. If the code runs what does the error message say? Look at the line number it mentioned. Go check!
  7. Step through your code (pythontutor.com_ is very good at this). Look at variable contents. Do they change like you expect them to?
  8. Use the rubber duck method! Explain out loud the problem to the rubber duck on top of your computer monitor (it is there, promise!). Often when we explain a problem we figure out the answer.
  9. Google what your error is. Try to understand the answers to other people's problems. Do they apply to yours?