Invalid syntax in elif

I need help with a code I have to do for computer science. It says invalid syntax for elif on line 48.

def rightTriangle (): length = float (input ("What is the length of the triangle you want to measure? ")) width = float (input ("What is the width of the triangle you want to measure? ")) area = 0.5 * length * width perimeter = float ((((length * length) + (width * width)) ** 0.5) + length + width) return area return perimeter def equalateralTriangle (): length = float (input ("What is the length of one of the sides of the triangle? ")) area = 5 * length (length * 3**.5) return area def parallelgoram (): length = float (input ("What is the length of a side of the parallelogram you want to measure? ")) width = float (input ("What is the width of the parallelgoram you want to measure? ")) area = length * width return area def rectangle (): length = float (input("What is the length of the rectangle you want to measure? ")) width = float (input ("What is the width of the rectangle you want to measure? ")) area = length * width return area def square (): length = float (input("What is the length of one of the sides you want to measure? ")) area = length * length return area def circle (): radius = float(input("What is the radius of the triangle you want to measure? ")) area = (radius * radius) * 3.14159 return area def Main (): response = input ("The avaiable shapes for finding area and perimeter are: \n (1) Right Triangle \n (2) Equalateral Triangle \n (3) Parallelogram \n (4) Rectangle \n (5) Square \n (6) Circle \nWhich shape do you want to choose? ") if response == "1": area = rightTriangle () print ("The area of your right triangle is " + str(area) + ". \n" elif response == "2" area = equalateralTriangle () print ("The area for your equalateral triangle is " + str(area) + ". \n" elif response == "3": area = parallelgoram () print ("The area for your parallelogram is " + str(area) + ". ") elif response == "4": area = rectangle () print ("The area for your rectangle is " + str(area) + ". \n") elif response == "5": area = square () print ("The area for your square is " + str(area) + ". \n" elif response == "6": area = circle () print ("The area for your circle is " + str(area) + ". \n") else: print (" You made an incorrect desicion. Please choose the options based through the numbers 1-6.") main () if again = input("Do you want to find the perimeter of the shape?") if again == "yes" or "Yes": Main () length = 0 ; width = 0 ; area = 0 ; radius = 0 ; perimeter = 0 print ("This is a program designed to ease all life's troubles with solving the area and perimeter of multiple shapes. For this program, enter the number beside the shape you want to find the area an and the perimeter of. \n") Main ()

double check your indentation & spacing and see if there are any missing colons or paraentheses in your functions.
Why are there two if statements after the else at the bottom?
Try commenting out portions of the code to see what happens.

Also, is there a reason that you’re making the numbers strings by using quotations?
ex:
if response == "1":

1 Like

Thanks, I fixed it and it was a few minor errors that led to the main error, but at least it works now

2 Likes