Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python distance calculator

#We need the math library for this
import math

x1, y1=int(input("Please enter a number: ")), int(input("Please enter a number: "))
x2, y2=int(input("Please enter a number: ")), int(input("Please enter a number: "))

distance = math.sqrt((x2-x1)**2 +(y2-y1)**2)
print("The distance is", distance)
Comment

calculate distance in python

from math import sqrt
def main():
	point1x, point1y = eval(input("Please enter coordinates of Point1 (use commas) "))
	point2x, point2y = eval(input("Please enter coordinates of Point2 (use commas)"))
	
	Distance = sqrt((point1x-point2x)**2 + (point1y-point2y)**2)
	print("The distance between this two points is", str(round(Distance, 4))+" units")
Comment

PREVIOUS NEXT
Code Example
Python :: remove duplicate space in string in pytoon 
Python :: how to print for loop in same line in python 
Python :: pandas row number by group 
Python :: pandas rename single column 
Python :: python multiply all elements in array by constant 
Python :: python logging to console exqmple 
Python :: find two number in python 
Python :: python read word document 
Python :: scikit learn linear regression 
Python :: python pdf merger 
Python :: how to clear checkbox in tkinter 
Python :: exact distance 
Python :: add padding to 2d matrix p 
Python :: euclidean distance python 
Python :: pandas count nan in each row 
Python :: flask run on ip and port 
Python :: drawkeypoints cv2 
Python :: list of characters python 
Python :: how to check if a message includes a word discord.py 
Python :: switch columns and rows python 
Python :: how to get the location of the cursor screen in python 
Python :: polarean share price 
Python :: number of columns with no missing values 
Python :: static dir in django python 
Python :: object.image.url email template django 
Python :: add numpy array to pandas dataframe 
Python :: python writelines newline 
Python :: pygame draw rect syntax 
Python :: palindrome Rearranging python one line 
Python :: launch google chrome using python 
ADD CONTENT
Topic
Content
Source link
Name
2+4 =