Help with function syntax error. [Python 2]


Hey guys, I've been looking for a solution to this issue for quite a while but can't wrap my head around it. Whenever I try to run the program, I expect the functions to run but I get a syntax error for newCharacter(), curveSetup() and printStatistics(). Any help is appreciated, heres an image of the error:

import random
import time
import math

def newCharacter():
 global name
 name = raw_input("Hello there, young adventurer. Whats your name? ") #'raw_input' is needed because we need the value as a string and not a variable.
 print "What an amazing name!"
 print "You are about to be transported to a world of mystery..."
 print ""
 print ""
 print ""

def curveSetup():
 global curve #'global curve' is needed so that code outside of the function knows what 'curve' is.
 curve = random.randint(12,45) #curve is needed for the exp needed to reach the next level. curve*lvl = exp needed to reach the next level.
 global lvl
 lvl = 1
 global exp
 exp = 0

def printStatistics():
 global expMax
 expMax = (lvl*curve)
 print "-------------------------------"
 print "       PLAYER STATISTICS       "
 print "-------------------------------"
 print ("Character Name : "+name)
 print ("Character Level: "+str(lvl))
 print ("Character Exp  : "+str(exp)+"/"+str(expMax)



Hi @bitrockstar90909 ,

Syntax errors often result from a mistake that a programmer makes on a line that precedes the one on which the interpreter reports the error. The error was discovered when this line was encountered ...


Therefore, it would be a good idea for you to carefully check this line for something that may remain unfinished ...

print ("Character Exp  : "+str(exp)+"/"+str(expMax)


Thanks, saw it, forgot a bracket. Works fine and dandy now.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.