Fix my code please, in python Question: Module: import math def distance(x1,y1,x2,y2,d): d=math.sqrt((x2-x1)**2+(y2+

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Fix my code please, in python Question: Module: import math def distance(x1,y1,x2,y2,d): d=math.sqrt((x2-x1)**2+(y2+

Post by answerhappygod »

Fix my code please, in python
Question:
Fix My Code Please In Python Question Module Import Math Def Distance X1 Y1 X2 Y2 D D Math Sqrt X2 X1 2 Y2 1
Fix My Code Please In Python Question Module Import Math Def Distance X1 Y1 X2 Y2 D D Math Sqrt X2 X1 2 Y2 1 (37.33 KiB) Viewed 15 times
Module:
import math
def distance(x1,y1,x2,y2,d): d=math.sqrt((x2-x1)**2+(y2+y1)**2) return ddef slope(x1,y1,x2,y2,m): m=(y2-y1)/(x2-x1) return mdef straight_line(x1,y1): return y-y1=m(x-x1)
Program:
import straight_line
def main(): x1=float(input('Enter the point x1')) y1=float(input('Enter the point y1')) x2=float(input('Enter the point x2')) y2=float(input('Enter the point x2'))
print('The distance of the two points is:',straight_line.distance(x1,y1,x2,y2)) print('The slope of a straight line is:',straight_line.slope(x1,y1,x2,y2)) print('The equation of the line is:',straight_line.straight_line(x1,y1))
main()
Distance between two points P(x1, y₁) and Q(x2, y2) in a straight line is given by: d = (x₂ − x₁)² + (Y₂ — Y₁)² y₂-y1 x2-x1 If the point P(x1, y₁) on a straight line, which has slope m, then the equation of the straight line is: y-y₁ = m (x-x₁) Create a module called straight line to compute, the distance between two points in a straight line, the slope of a straight line and the equation of a straight line. Write a test program to test your module. (Make sure to include comments) and the Slope of a straight line is given by m = where P(x1, y₁) and Q(x2, y2) are any two points on the line.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply