Advertisement
endzie_fyrge

[22] Overlapping Circles

Aug 8th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.74 KB | None | 0 0
  1. import math
  2.  
  3. first_center_x = int(input("Enter the x axis coordinate of the first circle center: "))
  4. first_center_y = int(input("Enter the y axis coordinate of the first circle center: "))
  5. second_center_x = int(input("Enter the x axis coordinate of the second circle center: "))
  6. second_center_y = int(input("Enter the y axis coordinate of the second circle center: "))
  7.  
  8. radius_one = int(input("Enter the radius of the first circle: "))
  9. radius_two = int(input("Enter the radius of the second circle: "))
  10.  
  11. centers = math.sqrt((first_center_x + second_center_x) ** 2 + (first_center_y + second_center_y) ** 2)
  12. radius = radius_one + radius_two
  13.  
  14. if radius > centers:
  15.     print("The circles overlap.")
  16. else:
  17.     print("The circles don't overlap.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement