Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Newbie guide
#1
I thought about it, and I couldn't find anything online that teaches programming methods.

Here is a list of things everyone should know.

1. Print everything.
If you have a new code nothing's worse than being in a pile of errors. If you print what you are doing (meaning every variable, snippet, ect) then you stop the errors before they start piling up.

2. Try every combination.
If you get an error complaining about your code you're first instinct is to change your code accordingly. To do this you must do different combinations of said code.

3. Look around the debug prompt.
A lot of syntax errors are just missing parenthesis or indent errors on the line before said line. Don't be scared to double check your code. It saves a lot of time and effort.

4. Use the forum
Not everything has a simple way of presenting itself. If you have a global variable that comes up as undefined you might need someone more experienced to help you out. I'm not saying to post every problem you gags on a forum, but when in need the forum does the deed.
Reply
#2
My experience tells me that 1. Print everything is not good advice starting from 3.7 <= Python. There is built-in breakpoint() now. It allows you to examine your program state, watch as the values of important variables change, and even modify the content of variables on the fly in very simple way. One or more breakpoints in right places will 'reveal' all what is going on. Beginners save tons of time using this instead of print - it usually takes only one run vs continuously adding print to code and run it over and over again.
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020