Print syntax query


#1

I am really new to this, so if this is a silly question, then I apologise now.

In CodeAcademy Python, the syntax for printing is:

print "Welcome to Python!"

Yet, when I look at things like Visual Studio or PyCharm, the syntax seems to be:

print ("Welcome to Python!")

So now I am confused.

As I type this, one of the popup suggested topics suggests that this might be a difference between Python 2 and Python 3...would this be right?

In the early stages of learning, I kinda need things to "just work", but at the moment I am distracted by the worry that what I am learning here at Code Academy is already out of date.

I'd be grateful if someone could talk me through this wobble of mine. :smile:


#2

python3:

print ("Welcome to Python!")

pyton2:

print "Welcome to Python!"

codecademy uses python 2.7 i believe to have read somewhere. It could be VS or PyCharm uses 3 already, maybe you could set it to python 2.7 if you want it to match CC (codecademy)


#3

Thank you for that.

I will look at whether I can use Python 2.7 and if so how.

I am wondering, though, if it would be better for me to learn Python 3 from the off, whether it would be less confusing for me, particularly if there are substantial differences.

All the same, thank you for replying.


#4

I will have to correct my answer, codecademy runs python 2.7.3, so close with my 2.7.

I think python3, python wiki has an extensive guide on it, you can find it here, i hope this helps. I think print is one the biggest, i find quora always really useful for this sort of thing, here is a question about the difference, with good answers and more links. or this one.


#5

Thanks for the links...unfortunately they were way over my head. I probably shouldn't have asked the question if I can't understand the answer. :confused:

I have now found I can use 2.7.11 with PyCharm, so I might be better off working through the tutorials here before worrying about 3. Learn to walk before I try running!

Thanks again :smile:


#6

They might be a bit overwhelming, but you can just save the links and read when ready.

2.7.11 and 2.7.3 are most likely not that different, that should work, good you got it to work.