Thanks a lot for your dedication to offering such wonderful knowledge …for free. We’re grateful!
Question- with some other learning resources (e.g. Pyhton.org - Dutch documentation) I learn that this is the right syntax for printing to the console:
print (“Hello world!”)
But in this course we’re taught the following:
print “Hello world!”.
I know of Codecademy that the teaching covers the best practices, so I wonder why the exclusion of brackets in the code.
A site used by a lot of programmers is stackoverflow.com
== discussions / opinions ==
python print() vs print site:stackoverflow.com
python expr vs tuple site:stackoverflow.com
python tuple explained site:stackoverflow.com
Best practice, as it were, is best practiced whence much practice has been done without consideration for it. Same applies to fine tuned syntax. If we focus on the t’s and the i’s, we miss the p’s and q’s. In other words write code that works, regardless. Now we begin to deconstruct and study that program. What makes it tick?
We might say, ‘well you wrote it, why deconstruct it?’ Answer: Because it forces us to look backwards through our own code which is analogous to proofreading from the end to the beginning of a manuscript. We find our mistakes, and often learn through the exercise of correcting those mistakes.
Eventually we become cognizant and conscientious of our code constructs. This is when to kick in best practice protocol. Why now? Because we understand what is expected and why from experience and retrospective examination of our own code. Until this time, any application of best practices is purely rote learning, and a garden path to black and white thinking.
Found an other nice thing…
== guidance ==
Thank you @leonhard_wettengmx_n and @mtf for your tips.
@mtf In my humble opinion: learning anything the best way ‘possible’ right from the beginning deserves the higher rank. Not much philosophy needed there.
I’m grateful guys.
Very inetersting indeed @leonhard_wettengmx_n. Thank you once more!
it can also have a Backfire effect…
= The Backfire Effect – You Are Not So Smart
Fortunately for us, programming is not founded upon any world view or belief system. It is rooted in empiricism, for the most part.
When people ask for the ‘best way’ or the ‘right way’ to do something, they invariably set themselves up to be parrots in an empirical world. That’s why I suggest a little clumsy learning before the empiricism is drilled in. There’s lots of time to learn syntax once enough mistakes have been made to understand why the syntax exists in the first plaice. That’s intuition.
We should let our intuition ride shotgun at all times, Eventually the institutional nuances will funnel in as needs be along the way. The empirical ways will filter in, regardless; we only need to hold them to a trickle over time so our imaginations don’t get stymied before we catch what we’re on to.
In the final analysis it’s a balancing act for anybody, keeping to the straight and narrow while also venturing off the beaten path; not forks in the road so much as diversions from it. We need structure and syntax, that’s sure, so long as we don’t corrupt the imagination with it.
For any teachable beginner with the same question asked above:
Python 2.x : print “Hello World!” —> ‘print’ is a statement
Python 3.x : print(“Hello, World!”) —> ‘print()’ is a function
More on the fundamental contrasts between the two: https://www.youtube.com/watch?v=f_6vDi7ywuA
Many times, the simplest answers are simply the best! Happy learning…