fork download
  1.  
  2. def sqr(x):
  3. return x*x
  4. def sqrt(n):
  5. x = n
  6. y = 1.0
  7. eps = 0.000001
  8. while x - y > eps:
  9. x = (x + y) / 2
  10. y = n / x
  11. return x
  12. def main():
  13. print("Circle:")
  14. x0 = float(input("x0="))
  15. y0 = float(input("y0="))
  16. R = float(input("R="))
  17. print("Point:")
  18. x = float(input("x="))
  19. y = float(input("y="))
  20. dist = sqrt(sqr(x-x0) + sqr(y-y0))
  21. print(dist)
  22. dist -= R;
  23. if dist < 0:
  24. print("The point is inside Circle")
  25. elif dist == 0:
  26. print("The point on the Circle")
  27. else:
  28. print("The point is outside Circle")
  29.  
  30. main()
Success #stdin #stdout 0.03s 9644KB
stdin
0
0
2
1
1
stdout
Circle:
x0=y0=R=Point:
x=y=1.4142135623746899
The point is inside Circle