-1

Below is my code which I am using to help me do my mathematics homework. When I run it, I get an 'invalid syntax' message with the variable 'y1' highlighted (look below for which one). I was wondering why, so when I looked up on this website similar titles nothing useful came up. So, what do I do? How do I stop y1 getting a syntax error?

import time

print("Hello, and welcome to the midpoint-finder-9001! Please insert the x1, y1, x2, and y2 coordinates when asked.")
x1=int(input("Please insert the x1 coordinate")
#This one below  VVVV. I've even tried replacing it with random stuff like 'wef'
# but the variable name still gets highlighted. Even using # doesn't work as it
#just goes onto x2 and says that *that* also has a syntax error.
y1=int(input("Please insert the y1 coordinate")
x2=int(input("Please insert the x2 coordinate")
y2=int(input("Please insert the y2 coordinate")

print("Thank you! Now please wait while I find the midpoint!")
time.sleep(1)

ansx=(x1+x2)/2
ansy=(y1+y2)/2

print("Interpreting co-ordinates....")
time.sleep(0.5)
print("Drawing line....")
time.sleep(1)
print("Finding midpoint location....")
time.sleep(0.3)
print("Finding co-ordinates...")
time.sleep(0.4)

print("The midpoint has been found! The midpoint co-ordinate is",ansx,",",ansy,".")
yn=raw_input("Would you like to see the working out? (yes/no only!)  ")

if yn.lowercase() == "yes"
    print("The working out is:")
    print("(",x1,"+",x2,") / 2")
    print(",")
    print("(",y1,"+",y2,") / 2")
else:
    print("Ok then! Have a great day!")

closed as off-topic by Steve Robillard, goldilocks Oct 15 '17 at 13:39

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question does not appear to be specific to the Raspberry Pi within the scope defined in the help center." – Steve Robillard, goldilocks
If this question can be reworded to fit the rules in the help center, please edit the question.

2

You have mismatched parenthesis (you are missing the closing parenthesis for the int function).

Change this line:

y1=int(input("Please insert the y1 coordinate")

To:

y1=int(input("Please insert the y1 coordinate"))

Note: You have the same problem in the next two lines.

Not the answer you're looking for? Browse other questions tagged or ask your own question.