Actual Python does not work as I was taught it was


#1

Hello! I’m completely new to programming and decided to learn some Python. I’ve not gotten so far in the course, but decided to download Python 3.7 to try some of the stuff out. But to my horror I realized that everything is different. A few examples could be how I suddenly have to put a ;\ to get to the next line, something I was never told in the course. Or how to print something I have to write print(“Hello world!”) instead of the more simple version I was taught print “Hello world!”. There are many other examples. Every time I try to do something I did in the course, it simply doesn’t work. This is getting really annoying, since I essentially can’t do anything in Python 3.7 at this point. Any help with this? Perhaps I downloaded a wrong Python or something? Is there a website with a “better” Python? Any help is welcome.


#2

python3 is the better version, there are indeed some differences. print() being the major one, it got promoted to function call in python3.

Blame python for this, they decide to break backward compatibility.

can you give an example of this?

Looking at the differences between python3 (what you downloaded) and python2 (codecademy course) should be enough to do things in python3


#3

Back in codecademy to access the next line I simply had to hit “Enter”. In the Python I downloaded I have to place a ;/ to get to the next line. So as an example if I wanted to make several strings, like

name = raw_input("What is your name? ")
age = raw_input("What is your age? ")
colour = raw_input("What is our favourite colour? ")

After writing the first line, instead of going to the next one so I could write it it runs the program. Only way to access the next line without the program running is placing a ;\ after it, like this:
name = raw_input("What is your name? ");\


#4

ah, you use the IDLE (integrated develop and learning environment). The IDLE is a great tool that ships with python.

But you can also just write .py files just like did in the lessons and execute them with the python interpreter.

The IDLE is great to try things, but just use a text-editor to write actual python scripts/programs.


#5

Thanks, but… That doesn’t really fix my problem… Another thing I just found out is if I just type in something like name = raw_input("What is your name? ") it says that “Raw Input is undefined”


#6

yes, raw_input got renamed input. That is another significant change.


#7

So you’re saying the CodeCademy course is outdated?


#8

actually, learning both versions is a good thing. It makes you understand the language better


#9

I see… That does make sense. Thanks a bunch! I’ll download an older version of Python then, just to test what I have learned


#10

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