On Mon, Aug 4, 2014 at 12:37 PM, Alex Kleider <aklei...@sonic.net> wrote:
> On 2014-08-04 10:28, Greg Markham 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 >> <http://www.amazon.com/Python-Programming-Absolute-Beginner- >> Edition/dp/1435455002/ref=sr_1_5?ie=UTF8&qid=1407049249&sr= >> 8-5&keywords=learning+python> >> >> by Michael Dawson. >> >> Code is provided for all the scripts found throughout the book (found here >> <http://www.delmarlearning.com/companions/content/ >> 1435455002/downloads/py3e_source.zip>), >> >> but I'm running into a syntax error when running one of the unmodified >> programs. On line 14, which reads: >> >> *print("Here", end=" ")* >> > try > > print("Here", end="") > > (no space between the quotes) > The end parameter defaults to newline. > If you change it to the empty string, there'll be no output of a newline > character. > As I understand it, newline is inferred unless the "end" parameter is used. This program is designed merely to illustrate the flexibility of the print function. As you'll see below, the output from the line in which I was receiving an error is intended to read as, "Here it is..." For clarity, the full program reads as follows: # Game Over - Version 2 # Demonstrates the use of quotes in strings # Python Programming for the Absolute Beginner, 3rd ed - Ch 2 # Greg Markham - Aug 04, 2014 print("Program 'Game Over' 2.0") print("Same", "message", "as before") print("Just", "a bit", "bigger") print("Here", end=" ") print("it is...") print( """ _____ ___ ___ ___ _____ / ___| / | / |/ | | ___| | | / /| | / /| /| | | |__ | | _ / ___ | / / |__/ | | | __| | |_| | / / | | / / | | | |___ \_____/ /_/ |_| /_/ |_| |_____| _____ _ _ _____ _____ / _ \ | | / / | ___| | _ \ | | | | | | / / | |__ | |_| | | | | | | | / / | __| | _ / | |_| | | |/ / | |___ | | \ \ \_____/ |___/ |_____| |_| \_\ """ ) input("\n\nPress the enter key to exit.")
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor