Nov-25-2018, 06:35 PM
(This post was last modified: Nov-25-2018, 07:50 PM by ichabod801.)
For some reason my code keeps giving me a syntax error when defining the second function
It will tell me "SyntaxError: invalid syntax" while "def" (for the second function is highlighted in red
It will tell me "SyntaxError: invalid syntax" while "def" (for the second function is highlighted in red
>>> counter = 0 >>> PassCounter = 0 >>> FailCounter = 0 >>> Average = 0 #This function does the calculations def Calc(): MidGrade = int(input("Your mid-term grade is: ")) print (str(MidGrade) + "%") FinGrade = int(input("Your Final grade is: ")) print (str(FinGrade) + "%") WeightedMid = MidGrade*.4 WeightedFin = FinGrade*.6 global Average Average = WeightedMid + WeightedFin #This function outputs the necessary information def Output(): print ("Your Average is: " + str(Average) + "%") counter = + 1 if Average > 59.99: print ("You have passed the course!") global PassCounter PassCounter = + 1 else: print ("You have failed the course.") global FailCounter FailCounter = + 1 print ("Number of grades calculated: " + str(counter)) print ("Number of students who have passed: " + str(PassCounter)) print ("Number of students who have failed: " + str(FailCounter)) print (Calc()) print (Output()) SyntaxError: invalid syntax
![[Image: do2iLKo.png]](https://i.imgur.com/do2iLKo.png)