Advertisement
GameNationRDF

Python Slope Finder 1.0

Feb 9th, 2014
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.60 KB | None | 0 0
  1. # Slope Finder by Umut Bilgic (GameNationRDF)
  2.  
  3. def blank():
  4.     print ("")
  5.  
  6. print ("Example point input: 5,12")
  7. blank()
  8.  
  9. while True:
  10.    
  11.     pos_1 = str(input("Point 1: "))
  12.     pos_2 = str(input("Point 2: "))
  13.  
  14.     pos_1_list = pos_1.split(",")
  15.     pos_2_list = pos_2.split(",")
  16.  
  17.     x1 = int(pos_1_list[0])
  18.     y1 = int(pos_1_list[1])
  19.     x2 = int(pos_2_list[0])
  20.     y2 = int(pos_2_list[1])
  21.  
  22.     deltax = x2 - x1
  23.     deltay = y2 - y1
  24.  
  25.     slope = deltax / deltay
  26.  
  27.     blank()
  28.     print ("Slope 0f the line: " + str(slope))
  29.     print ("--------------------------------")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement