def middleNum (num1,num2,num3):
if (num1 >= num2 and num1 <= num3):
return (num1)
elif (num2 >= num1 and num2 <= num3):
return (num2)
else:
return (num3)
def isOnLine (xCord1,yCord1,xCord2,yCord2,xCord3,yCord3):
mSlope1 = (yCord2 - yCord1) / (xCord2 - xCord1)
mSlope2 = (yCord3 - yCord2) / (xCord3 - xCord2)
if (mSlope1 == mSlope2):
return print("The coordinate ({},{}) is on the line.".format(xCord3,yCord3))
else:
return print ("The coordinate ({},{}) is not on the line.".format(xCord3,yCord3))
def isInsideCircle (xCenter,yCenter,radius,cord1,cord2):
if ((x - xCenter)^2 + (y - yCenter)^2 <= radius^2):
return print("The point is within the circle.")
else:
return print("The point is not withing the circle.")
print ("1.")
num1 = int(input("Input digit: "))
print()
num2 = int(input("input digit: "))
print()
num3 = int(input("input digit: "))
print()
print ("The middle digit is {}".format(middleNum (num1,num2,num3))
print()
print("2.")
xCord1 = int(input("Input the x value for the first coordinate: "))
print()
yCord1 = int(input("Input the y value for the first coordinate: "))
print()
xCord2 = int(input("Input the x value for the second coordinate: "))
print()
yCord2 = int(input("Input the y value for the second coordinate: "))
print()
xCord3 = int(input("Input the x value for the third coordinate: "))
print()
yCord3 = int(input("Input the y value for the third coordinate: "))
print()
print (isOnLine (xCord1,yCord1,xCord2,yCord2,xCord3,yCord3))
print()
print ("3.")
xCenter = int(input("Input the x value for the coordinate of the center of the circle: "))
print()
yCenter = int(input("Input the y value for the coordinate of the center of the circle: "))
print()
randius = int(input("Input the value for the radius of the circle: "))
print()
cord1 = int(input("Input the x value for the second coordinate: "))
print()
cord2 = int(input("Input the y value for the second coordinate: "))
print()
print (isInsideCircle (xCenter,yCenter,radius,cord1,cord2)
它表示错误在第31行,但如果我将其提交,则下一行会导致错误,如果我将其提交,则下一行会导致错误,依此类推。如果我从这一行提交剩下的代码,我得到一个EOF解析错误。
答案 0 :(得分:2)
print ("The middle digit is {}".format(middleNum (num1,num2,num3))
...
print (isInsideCircle (xCenter,yCenter,radius,cord1,cord2)
这些陈述中的parens是不平衡的。