i think people should keep a mental list of the most common
problems people make when writing a program.
then check each line/varible/file name/loop in the program against the mental list.
i got a lecture at the start of the year in python
for three years in a row on the most common mistakes people make.
i still after three years make those mistakes in every single program i write no matter how small.
even if it’s a single line!
but the average number of mistakes i make seems to have decreased
and i seem to be able to notice and correct these mistakes much faster,
then when i started the course.
some of the usual mistakes are:
1:spelling mistakes or spelling something differently.
e.g. friends=5 instead of friend=5.
2:or using or missing capital letters.
e.g. ninja instead of Ninja.
e.g. forgetting to use two ==
if count = 0: this is meant to be if count == 0:
or leaving out the colon after the 0
e.g. if count == 0
or most importantly leaving out a bracket
print (‘Hello World’
print (Hello World)
e.g. for letter in ‘hello world’:
print letter should be tabbed in.
i could have had a mental list of these problems but i was too lazy.
and by now i seem to know most of them.
like leaving a space in the name of a varible or filename.
my file = ‘Hello World.py’
instead of my_file = ‘Hello_World.py’
this list would greatly decrease the time it takes to troubleshoot a program.
also it’s great for remembering syntax,builtin varibles or steps to using some part of the language.
like when you learn how to add or remove things to a list or dictionary.
you can put the steps and syntax in your memory palace.
or even around the room as you see the.
.startswith() or .endswith()
.split() or .strip()
or keywords etc.
from … import *