Advertisement
Guest User

Untitled

a guest
Apr 8th, 2020
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.69 KB | None | 0 0
  1. import math
  2.  
  3. x1 = 0
  4. x2 = 0
  5. y1 = 0
  6. y2 = 0
  7.  
  8.  
  9.  
  10.  
  11.  
  12. def inputs():
  13.     global x1
  14.     global x2
  15.     global y1
  16.     global y2
  17.     x1 = int(input("Prosze podać x1: "))
  18.     x2 = int(input("Prosze podać x2: "))
  19.     y1 = int(input("Prosze podać y1: "))
  20.     y2 = int(input("Prosze podać y2: "))
  21.  
  22.  
  23.  
  24.  
  25.  
  26. print("Prosze o wprowadzenie wpspółrzędnych \n")
  27. while True:
  28.     try:
  29.         inputs()
  30.         a = x2 - x1
  31.         b = y2 - y1
  32.         d = a **2 + b **2
  33.         c = math.sqrt(a ** 2 + b ** 2)
  34.         print(d)
  35.         print(c)
  36.         break
  37.     except:
  38.         print("Coś poszło nie tak przy wporwadzaniu koordynatów")
  39.         print("Proszę prowadzić jeszcze raz !")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement