[Tutor] noob question (Windows, Python 3.1)

Alan Gauld alan.gauld at btinternet.com
Thu Aug 6 19:37:37 CEST 2009


"Joshua Harper" <joshharper27 at gmail.com> wrote

> Ok, so I am trying to learn python, and I am reading many tutorial type

If you are just learning Python downgrade from 3.1 to v2.6.

Most tutorials are not up to 3.1 yet and there are many differences.
v3.1 was a big change to the language.

eg. The following code is for v2, it needs changing for v3:

> x = input("Please enter a number: ")

x = int( input("Please enter a number: ") )

> print "The square of that number is

print ( "The square of that number is )

> I save this as a .py and Open With>python.exe. OK, so that gives me the
> terminal ansking me to enter a number, I enter a number and click enter 
> and
> then it prints in like half a nanosecond and the cmd line window closes.

Others have answered this.
You really need an option though that will display the error message that
I suspect you are getting...

Start a CMD window and run the python command by typing the command
at the DOS prompt.

eg

C:\Windows> python some\path\to\myscript.py


That way you will still see the error message after the
program finishes.

HTH,

BTW My tutorial is nearly half way to being converted to v3 now,
you might find it useful if you don;t want to revert to 2.6. But personally
I'd go back!

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/l2p/ 




More information about the Tutor mailing list