xxxxxxxxxx
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")
xxxxxxxxxx
import math.
def calculateDistance(x1,y1,x2,y2):
dist = math.sqrt((x2 - x1)**2 + (y2 - y1)**2)
return dist.
print calculateDistance(x1, y1, x2, y2)
xxxxxxxxxx
#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)
xxxxxxxxxx
r = input("enter how fast are you going?: ")
t = input("how long did it take you?: ")
d = int(r) * int(t)
print("The distance was:", d)
xxxxxxxxxx
/*
To create a MongoDB connection string with a username and password,
you typically format it as follows:
*/
const url = "mongodb://<username>:<password>@<host>:<port>/<database>"
// For a MongoDB Atlas connection, you might use:
// mongodb+srv://<username>:<password>@<cluster-url>/<database>?<options>
const url = "mongodb+srv://<username>:<password>@<cluster-address>/<database>?retryWrites=true&w=majority"
/*
Be sure to replace <username>, <password>, <host>, <port>,
<database>, and <cluster-address> with your actual connection details.
*/