[Tutor] New to Python - print function - invalid syntax

Joel Goldstick joel.goldstick at gmail.com
Mon Aug 4 20:52:25 CEST 2014


On Mon, Aug 4, 2014 at 1:28 PM, Greg Markham <greg.markham at gmail.com> wrote:
> Hello,
>
> I'm extremely new to Python having only just started learning this week.
> I'm slowly plodding through a book, Python Programming for the Absolute
> Beginner, 3rd ed by Michael Dawson.
>
> Code is provided for all the scripts found throughout the book (found here),
> but I'm running into a syntax error when running one of the unmodified
> programs.  On line 14, which reads:
>
> print("Here", end=" ")
>
> I'm receiving a syntax error which points to the end parameter.  In order to
> confirm this, I modified the code to read:
>
> print("Here ")
>
> ...which runs without incident.  My best guess is that there's a minor
> difference between the version of Python I'm using (3.4.1) and that which
> was in use at the time the book was written (3.1.x) that is responsible for
> this error.

Welcome to the group.  I think you made a typo.  Your code should run.
I just tried this:
>>> print("hi", end=" ")
hi >>>

A couple of things that will make it easier to help:

1. send mail as plain text.  Rich text causes some readers problems
2. copy and paste the code and complete traceback.  retyping things
make it more likely that what is in your code isn't exactly what you
typed

>
> Thanks and my apologies for the "greenness" of this question.

No apologies necessary -- ask away
>
> Sincerely,
>
> Greg
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>



-- 
Joel Goldstick
http://joelgoldstick.com


More information about the Tutor mailing list