[Tutor] Could you look over my code?
robertvstepp at gmail.com
Mon Jan 5 04:53:37 CET 2015
On Sun, Jan 4, 2015 at 8:39 PM, Steven D'Aprano <steve at pearwood.info> wrote:
>> 2. Have a look at this code fro the book and tell me what to improve
>> (This is a program where it says game over, and it waits for the user
>> to press the enter key to quit:
>> print(“Game Over”)
>> input(“\n\nPress the enter key to exit”)
> Are you using Python 3 or better? If so, that code is absolutely fine
> and will work perfectly. It is so short and sweet that there is nothing
> to improve.
> If you are using Python 2, you may find that it gives you an error,
> which will probably look like this:
> SyntaxError: unexpected EOF while parsing
> Don't be distressed! You've just stumbled across a small difference
> between Python version 2 and version 3. In Python 3, you should use
> "raw_input" instead of "input", so your code will look like this:
In the paragraph above, I believe that Steven meant to say, "...
version 3. In Python 2, you should use ...", which should be evident
from his earlier comments.
More information about the Tutor