Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   Print Function (http://www.velocityreviews.com/forums/t952517-print-function.html)

gengyangcai@gmail.com 09-21-2012 08:20 PM

Print Function
 
Hello ,


I am currently using Python 3.2.3 . WHen I use the print function by typing print "Game Over" , it mentions " SyntaxError : invalid syntax ". Any ideas on what the problem is and how to resolve it ? Thanks a lot .


GengYang

Rodrick Brown 09-21-2012 08:28 PM

Re: Print Function
 
Go away troll!

Sent from my iPhone

On Sep 21, 2012, at 4:27 PM, "gengyangcai@gmail.com"
<gengyangcai@gmail.com> wrote:

> Hello ,
>
>
> I am currently using Python 3.2.3 . WHen I use the print function by typing print "Game Over" , it mentions " SyntaxError : invalid syntax ". Any ideas on what the problem is and how to resolve it ? Thanks a lot .
>
>
> GengYang
> --
> http://mail.python.org/mailman/listinfo/python-list


Tarek Ziadé 09-21-2012 08:29 PM

Re: Print Function
 
On 9/21/12 10:20 PM, gengyangcai@gmail.com wrote:
> Hello ,
>
>
> I am currently using Python 3.2.3 . WHen I use the print function by typing print "Game Over" , it mentions " SyntaxError : invalid syntax ". Any ideas on what the problem is and how to resolve it ? Thanks a lot .


print was a statement in python 2.x, it is now a function so you need
parenthesis:

>>> print("Game Over")

Game Over

>
>
> GengYang



Ian Kelly 09-21-2012 08:54 PM

Re: Print Function
 
On Fri, Sep 21, 2012 at 2:28 PM, Rodrick Brown <rodrick.brown@gmail.com> wrote:
> Go away troll!


Troll? It looked like a sincere question to me.

John Gordon 09-21-2012 09:17 PM

Re: Print Function
 
In <db8c7111-8fc7-4884-8c58-987399f7793f@googlegroups.com> gengyangcai@gmail.com writes:

> I am currently using Python 3.2.3 . WHen I use the print function by
> typing print "Game Over" , it mentions " SyntaxError : invalid syntax ".
> Any ideas on what the problem is and how to resolve it ? Thanks a lot .


In python version 3, print was changed into a function.

Use this and it will work:

print("Game Over")

--
John Gordon A is for Amy, who fell down the stairs
gordon@panix.com B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"


Ian Kelly 09-21-2012 10:43 PM

Re: Print Function
 
On Fri, Sep 21, 2012 at 3:11 PM, Alister <alister.ware@ntlworld.com> wrote:
> On Fri, 21 Sep 2012 14:54:14 -0600, Ian Kelly wrote:
>
>> On Fri, Sep 21, 2012 at 2:28 PM, Rodrick Brown <rodrick.brown@gmail.com>
>> wrote:
>>> Go away troll!

>>
>> Troll? It looked like a sincere question to me.

>
> but one that page 1 of the documentation would answer.


So point the asker to the documentation, don't just dismiss them as a troll.

This newsgroup has a reputation for being friendly. Let's keep it that way.

Steven D'Aprano 09-22-2012 01:26 AM

Re: Print Function
 
On Fri, 21 Sep 2012 13:20:09 -0700, gengyangcai wrote:

> I am currently using Python 3.2.3 . WHen I use the print function by
> typing print "Game Over" , it mentions " SyntaxError : invalid syntax
> ". Any ideas on what the problem is and how to resolve it ?


No, none what so ever. Perhaps you are the first person in the world to
have come across this error. If you ever solve it, please write up the
solution and put it on a blog or a website somewhere so that if it ever
happens again, googling for "python print SyntaxError" will return a
useful result.

Tongue-firmly-in-cheek-ly y'rs,


--
Steven

Mark Lawrence 09-22-2012 07:27 AM

Re: Print Function
 
On 22/09/2012 02:26, Steven D'Aprano wrote:
> On Fri, 21 Sep 2012 13:20:09 -0700, gengyangcai wrote:
>
>> I am currently using Python 3.2.3 . WHen I use the print function by
>> typing print "Game Over" , it mentions " SyntaxError : invalid syntax
>> ". Any ideas on what the problem is and how to resolve it ?

>
> No, none what so ever. Perhaps you are the first person in the world to
> have come across this error. If you ever solve it, please write up the
> solution and put it on a blog or a website somewhere so that if it ever
> happens again, googling for "python print SyntaxError" will return a
> useful result.
>
> Tongue-firmly-in-cheek-ly y'rs,
>
>


+ one trillion

--
Cheers.

Mark Lawrence.


Walter Hurry 09-22-2012 11:28 PM

Re: Print Function
 
On Sat, 22 Sep 2012 01:26:43 +0000, Steven D'Aprano wrote:

> On Fri, 21 Sep 2012 13:20:09 -0700, gengyangcai wrote:
>
>> I am currently using Python 3.2.3 . WHen I use the print function by
>> typing print "Game Over" , it mentions " SyntaxError : invalid syntax
>> ". Any ideas on what the problem is and how to resolve it ?

>
> No, none what so ever. Perhaps you are the first person in the world to
> have come across this error. If you ever solve it, please write up the
> solution and put it on a blog or a website somewhere so that if it ever
> happens again, googling for "python print SyntaxError" will return a
> useful result.
>
> Tongue-firmly-in-cheek-ly y'rs,


I think OP rather gave the game away with the subject line.


All times are GMT. The time now is 09:32 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.