0

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?

2
  • 3
    Can you post the actual error? Commented Jan 18, 2013 at 1:40
  • Why are you printing inside your class definition and not inside any methods? Commented Jan 18, 2013 at 4:32

1 Answer 1

3

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")
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.