[Tutor] New User-Need-Help

Joel Goldstick joel.goldstick at gmail.com
Fri Feb 15 23:05:51 CET 2013


On Fri, Feb 15, 2013 at 5:03 PM, Deborah Piotrowski
<spiceninja4u at gmail.com>wrote:

>
>
> On Fri, Feb 15, 2013 at 2:58 PM, Joel Goldstick <joel.goldstick at gmail.com>wrote:
>
>>
>>
>>
>> On Fri, Feb 15, 2013 at 4:45 PM, Deborah Piotrowski <
>> spiceninja4u at gmail.com> wrote:
>>
>>> Hi,
>>>
>>>
>>> I am very new to Python, I am using the e-book "Python Programming for
>>> the Absolute Beginner" and am starting with a simple "Game Over" Program.
>>>  This is the code:which is extremely simple!
>>> print"Game Over" raw_input("\n\nPress Enter Key to exit")
>>>
>>
>> welcome Nicholas
>>
>>
>> One important thing about python is indentation is important.  You have
>> presented your code in a way that can't be.  Can you actually copy your
>> program and paste it into an email message.  Also, Windows, Linux, Mac?
>>
>>
>>
>>> That's it. It is supposed to bring up a window that says "Game Over" and
>>> at the bottom say "Press enter Key to exit" and when you press the enter
>>> key it is supposed to exit(big suprise).
>>> But all it does is highlight "raw_input" and says "invalid syntax" Now,
>>> if I just put "print "Game Over"" then it says Game Over UNDERNEATH the
>>> code I just printed!
>>> now I am following the book to the *pixel* and that is not what is
>>> supposed to happen!
>>> Please email me back as soon as you get this...(if you are not to busy).
>>>
>>> Thanks,Nicholas
>>>
>>> --
>>> http://mail.python.org/mailman/listinfo/python-list
>>>
>>>
>>
>>
>> --
>> Joel Goldstick
>> http://joelgoldstick.com
>>
>
>
> Sorry, I am using Windows 7 Ultimate 32-bit with Python 3.3
> Here is the code in exact form
> print "Game Over"
>      raw_input("\n\nPress Enter Key to Exit")
> Thanks,
> Nicholas


You need to unindent the raw_input like so:

print "Game Over"
raw_input("\n\nPress Enter Key to Exit")

In python you indent code blocks (like for loops, if statements, function
blocks, etc.).  You can't just indent from one line to the next in
sequential code or you will be told its a syntax error



-- 
Joel Goldstick
http://joelgoldstick.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130215/7bb68001/attachment-0001.html>


More information about the Tutor mailing list