On Fri, Nov 13, 2009 at 2:17 PM, biboy mendz <[email protected]> wrote:
> http://inventwithpython.com
>
> chapter 8: hangman.py
>
> expression is: print(letter, end=' ')
>
> it explained:
> end keyword argument in print() call makes the print() function put a space
> character at the end of the string instead of a newline.
>
> however when run it gives error: SyntaxError: invalid syntax.
>
> What gives? This is the first time i saw such expression inside print
> function. Is this version-specific of python? I'm running version 2.5.4.
>

Yes, the print function is a new feature of python 3. The equivalent
statement in python 2.5 is probably something like this:

print letter, ' ',

The print function is a statement in python before 3.0. It takes a
comma-separated list of things to print. The trailing comma prevents
python from appending a newline.

Hugo
_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to