user1987349
user1987349

Reputation: 105

Syntax error in string

I'm getting a syntax error when I run this:

class Stats:
    Str = random.randint(3,18)
    Int = random.randint(3,18)
    Wis = random.randint(3,18)
    Char = random.randint(3,18)
    Con = random.randint(3,18)
    print "Type the name of a stat (Str, Int, Wis, Char or Con) to see its value"

It says that the 'closing' quote is a syntax error- since when are strings syntax errors?

Upvotes: 0

Views: 197

Answers (1)

Pavel Anossov
Pavel Anossov

Reputation: 62948

Are you using python 3+? print is a function in python 3.

class Stats:
    Str = random.randint(3,18)
    Int = random.randint(3,18)
    Wis = random.randint(3,18)
    Char = random.randint(3,18)
    Con = random.randint(3,18)
    print("Type the name of a stat (Str, Int, Wis, Char or Con) to see its value")

Upvotes: 3

Related Questions