Tips for learning and finding mistakes in your code


When learning how to code, testers often find it challenging to follow along and practice their learnings.  

Based on my experiences while learning how to do Python programming, here are some tips that helped me, which I believe could help others as well when learning to code.

  1. When you copy code from one location (example code, friend’s code) review each line of code going backward.  What do you mean by reading the code backward?  Start at the last line. Compare that line in your file to the same line in the example code. Once it’s exactly the same, move up to the next line. Do this until you get to the first line in the file.

  2. Read what you have typed out loud, including saying each character by name.

  3. When you make a mistake write down what mistake you made.

  4. When learning to code, before you go to the next practice exercise, look at the mistakes you have made previously and try not to make them this time.

  5. Practice translating the code to English by writing a comment above each line explaining to yourself what it does.

  6. Try to break your code and then fix it.

  7. Find as many different ways to break your code until you get tired or exhaust all possibilities.

  8. Get a friend to break your code and you try to fix it.

  9. Add extra “debug” print statements that print out the value of variables, and that tell you when you are inside a function and when you exit it etc.

  10. Type help() in the interactive python interpreter for interactive help, or type help(object) for help about an object, to find information about python keywords e.g. help(input) will show the help information for the ‘input’ function.

Next
Next

How to do basic Input & Output operations in Python