# The if statement can detect if a value is wrong (less than zero in this case)... # ...but the user could still enter bogus values the second time. def Distance(X1,Y1,X2,Y2): DeltaX = X2 - X1 DeltaY = Y2 - Y1 return sqrt(DeltaX*DeltaX + DeltaY*DeltaY) def Main(): A1 = input("Enter X1 --- ") if (A1 < 0): print "This value is bogus" A1 = input("Enter X1 --- ") B1 = input("Enter Y1 --- ") if (B1 < 0): print "This value is bogus" B1 = input("Enter Y1 --- ") A2 = input("Enter X2 --- ") if (A2 < 0): print "This value is bogus" A2 = input("Enter X2 --- ") B2 = input("Enter Y2 --- ") if (B1 < 0): print "This value is bogus" B2 = input("Enter Y2 --- ") print Distance(A1,B1,A2,B2) return