Debug Tips:
Reprint please declare this article citation source: Look at Daniel's small fresh
1. In the first programming, the else is written after each if, so that if your else is not supposed to run, then you can output the state information at this time in else to easily troubleshoot the bug
2. Do not nest too many if (for example, more than 2 layers), because nesting means you need to look back and forth at different levels of conditions, try to use a layer of if to do
3. Treat if-else like a paragraph, add empty lines at the beginning and end of them , and if-elif-else as sentences in a paragraph
The bool expression in 4.if should be as concise as possible, if the state is complex, save it with a variable, and give the variable a good name.
Warning:never is a slave to the rules in real life. For training purposes, you need
To follow these rules-to-make your mind strong, but in real life sometimes these rules
is just stupid. If you think a rule was stupid, try not using it.
About debugging and programming:
1.Make sure parts of your programs work as a work on them. Do not write massive files
of code before you try to run them. Code a little, run a little, fix a little.
About engineering Capability:
One final word of advice:all programmers become paralyzed by irrational fear starting a new
Large project. They procrastinate to avoid contronting this fear and end up not getting their pro-
Gram working or even started. I do this. Everyone does this. The best of the avoid
A list of things you should does and then does them one at a time.
Just start doing it, do a small version, make it bigger, keep a list of things to does, and do them.
2.The best-use-to-debug a program is-use print-to-print out the values of variables at
Points in the program to see where they go wrong.
Tips for Python debug tips && engineering Capabilities