{"id":16898,"date":"2021-08-17T08:51:20","date_gmt":"2021-08-17T03:21:20","guid":{"rendered":"https:\/\/python-programs.com\/?p=16898"},"modified":"2021-11-22T18:37:21","modified_gmt":"2021-11-22T13:07:21","slug":"python-program-to-check-if-two-lines-are-parallel-or-not","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-check-if-two-lines-are-parallel-or-not\/","title":{"rendered":"Python Program to Check if two Lines are Parallel or Not"},"content":{"rendered":"

In the previous article, we have discussed Python Program to Find the Greatest Digit in a Number.<\/a>
\nParallel Lines :<\/strong><\/p>\n

If two lines remain the same distance apart along their entire length, they are said to be parallel. They will not meet no matter how far you stretch them. These lines are denoted by the equations ax+by=c.<\/p>\n

The line equation is ax+by=c, where an is the x coefficient and b is the y coefficient. If the slopes of two lines are equal, we say they are parallel. As a result, we must determine the slope, which is “rise over run.”<\/p>\n

The straight-line equation is y=mx+c, where m is the slope. Take a1,b1,c1 and a2,b2,c2 from the user and see if they are parallel.<\/p>\n

Given the values of equations of two lines, and the task is to check if the given two lines are parallel or not.<\/p>\n

Examples:<\/strong><\/p>\n

Example 1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

a1=4, b1=8, c1=13\r\na2=2, b2=4, c2=7<\/pre>\n

Output:<\/strong><\/p>\n

The given lines are parallel to each other<\/pre>\n

Example 2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

a1=8, b1=0, c1=9\r\na2=8, b2=0, c2=11<\/pre>\n

Output:<\/strong><\/p>\n

The given lines are parallel to each other<\/pre>\n

Program to Check if two Lines are Parallel or Not<\/h2>\n

Below are the ways to check if the given two lines are parallel or not.<\/p>\n