Invalid Syntax from a book example

This is the place for queries that don't fit in any of the other categories.

Invalid Syntax from a book example

Postby linuxdesire » Fri Nov 15, 2013 6:52 pm

I am a complete beginner and I am using the coding from a beginner's book. But I am getting a syntax error. I am getting it on line 12, print("Here", end = " " ) is seems to be pointing at the equal sign. I copied it exactly like the book.

Code: Select all
# Game Over - Version 2
# Demonstrates the use of quotes in strings

print ("Programs 'Game Over' 2.0"

print ("Same", "message", "as before")

print ("Just"
         " a bit"
         " bigger")

print ("Here", end = " ")    [i][u]Syntax Error: invalid syntax There is a little arrow under the equal sign.[/u][/i]

print ("it is...")

print (
            """
)
linuxdesire
 
Posts: 9
Joined: Fri Nov 15, 2013 6:45 pm

Re: Invalid Syntax from a book example

Postby metulburr » Fri Nov 15, 2013 7:35 pm

Code: Select all
print ("Here", end = " ")

this is a feature of python3.x
I am assuming you are using python2.x?
New Users, Read This
OS Ubuntu 14.04, Arch Linux, Gentoo, Windows 7/8
https://github.com/metulburr
steam
User avatar
metulburr
 
Posts: 1502
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

Re: Invalid Syntax from a book example

Postby linuxdesire » Fri Nov 15, 2013 9:46 pm

Excellent. You were correct. My version of Linux has 2.7 installed. When I ran it in 3.3.2 it worked fine. Thank you.
linuxdesire
 
Posts: 9
Joined: Fri Nov 15, 2013 6:45 pm


Return to General Coding Help

Who is online

Users browsing this forum: W3C [Linkcheck] and 3 guests