Re: [Tutor] Help - My First Program Fails
Hi Steven. Thank you for your answer below. The program now runs, using print(Game Over). I use Python 3..; but the book - python for absolute beginner - that I have is an old (2003) edition. I don't know how this combination may affect my learning, going forward. Could you please suggest how I can something current. Regards. Tayo. My answer to your question appears below: On Sun, Sep 09, 2012 at 03:56:22PM -0700, tayo rotimi wrote: My first exercise: print Game Over does not run! Where have I missed it? The error message is as follows: ?File stdin, line 1 ?? print Game Over ??? ??? ??? ??? ??? ^ ?SyntaxError: invalid syntax Are you using Python 3 instead of Python 2? One of the changes between the 2.x versions and the 3.x versions is that print is no longer a statement, but is now a function. That means you have to write it using round brackets (parentheses for Americans): # version 2.x print Game Over # version 3.x print(Game Over) For simple printing, there's not much advantage either way, but for more advanced printing, the function form is much better. -- Steven___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Help - My First Program Fails
On 10/09/12 19:40, tayo rotimi wrote: Hi Steven. Thank you for your answer below. The program now runs, using print(Game Over). I use Python 3..; but the book - python for absolute beginner - that I have is an old (2003) edition. I don't know how this combination may affect my learning, going forward. Could you please suggest how I can something current. You could buy a more current book that covers Python 3 :) E.g. http://www.apress.com/9781430216322 (This is not a recommendation, just the first one I stumbled across.) But honestly, there aren't that many differences between Python 2 and 3. print is the main one. There are a few others, but they are mostly advanced functionality. In my opinion, with a little bit of care and attention to detail, if you are prepared to check the notes in the Fine Manual and if necessarily ask for help here, you can learn Python 3 from a Python 2 book. It won't be *as* convenient, of course, but it will be doable. -- Steven ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Help - My First Program Fails
Please, please, PLEASE do not reply to a digest without deleting the irrelevant text from your email! We don't need to read HUNDREDS of lines of text we've already seen before. When you want to start a *new* question, ALWAYS start a fresh, blank email, set the To address to tutor@python.org, and DO NOT reply to a digest. Thank you. My answer to your question appears below: On Sun, Sep 09, 2012 at 03:56:22PM -0700, tayo rotimi wrote: My first exercise: print Game Over does not run! Where have I missed it? The error message is as follows: File stdin, line 1 print Game Over ^ SyntaxError: invalid syntax Are you using Python 3 instead of Python 2? One of the changes between the 2.x versions and the 3.x versions is that print is no longer a statement, but is now a function. That means you have to write it using round brackets (parentheses for Americans): # version 2.x print Game Over # version 3.x print(Game Over) For simple printing, there's not much advantage either way, but for more advanced printing, the function form is much better. -- Steven ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor