Parenthesis - Dumb question


#1

Ok, So I am really confused. I used the pycharm program to start fooling around with programming. The thing is. The first thing I tried to do was hello world and it is different than what is being taught in code academy.

I tried the following code as taught in codeacademy

Print "hello world" (this resulted in a syntax error.)

The correct version for pycharm is
print ('hello world')

This may seem nit picky but what are we not being taught to use parenthesis the correct way? Why is code academy code different than real world. I would love a good explanation here. I cant imagine a good reason why this is different.


#2

In Python 2, print is a construct, whereas in Python 3 it is a function. We invoke a function with ().

When the course was written, Python 3 was gaining traction but the powers that be at CC must have opted to introduce Python 2 since it is the core language. Learning both is still the way to go in the long run.


#3

Wow, thank you for the quick response. Further dumb questions. I am assuming code academy is then teaching in 2 versus 3.


#4

Apparently Python 3 has been around since Feb 2009. Was Codecademy's Python course created before then? I find this unusual, too.
https://docs.python.org/3.0/whatsnew/3.0.html


#5

Learning Python 3 out of the box prevents us from recognizing Python 2 code when we are reading old code. There are several differences that should be learned. I'm of the opinion that Python 2 should be taught first.


#6

    print  versus  print()

is just one of the differences.

    raw_input()  vs.  input()

range returning a list vs. returning an iterator.

Same applies to map().


#8

Isn't the course getting updated sometime this summer?
https://www.codecademy.com/blog/important-changes-to-codecademy-courses


#9

It may well be, and the new material may be Python 3, but it doesn't remove the need to know Python 2, at least in terms of the differences.


#10

Well of course, I don't know if I would be able to understand Python 3 as well as I do without having first learned JavaScript and then Python 2.7.


#11

Supplemental

Following is an article from last year...


#12

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.