Computer Science, asked by vchandola64391, 6 months ago

Z 412 The Slopes of Line Segments Hacker rank Python
In the town of line segments two line segments can only become friends if their slopes are equal. Line segments are not smart enough to calculate their own or some other line segment's slope so they use a machine called the slope Finder to check their compatibility. Recently someone stole the slope Finder and now the line segments are upset because they cannot make new friends. The Mayor of the town has hired you to write a code to fix the crisis that their town is facing?

Answers

Answered by poojan
23

The slopes of line segments program:

Program:

slopes=[]

#taking the attributes of 2 line segments and calculating their slopes

for i in range(2):

   xa,ya,xb,yb=map(int,input().split())

   slope=(yb-ya)/(xb-xa)

   slopes.append(slope)

#Checking if the slopes are equal or not

if slopes[0]==slopes[1]:

   print("yes")

else:

   print("no")

Input:

0 0 1 1

1 0 2 1

Output:

Yes

Learn more:

1) Write a Python function sumsquare(l) that takes a nonempty list of integers and returns a list [odd,even], where odd is the sum of squares all the odd numbers in l and even is the sum of squares of all the even numbers in l.

brainly.in/question/15473120

2) Python program to find absolute difference between the odd and even numbers in the inputted number.

brainly.in/question/11611140

Attachments:
Similar questions