[Tutor] Question re: hangman.py

Alan Gauld alan.gauld at btinternet.com
Fri Nov 13 18:49:58 CET 2009


"biboy mendz" <bibsmendez at gmail.com> wrote

> 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.

Your tutorial is using version 3.
In 2.6 simply put a comma after the string:

print letter,

to do the same thing. 




More information about the Tutor mailing list