## Task

Your challenge is to write a function named `getSlope`/`get_slope`/`GetSlope` that calculates the slope of the line through two points.

## Input

```if:javascript,python
Each point that the function takes in is an array 2 elements long. The first number is the x coordinate and the second number is the y coordinate.
If the line through the two points is vertical or if the same point is given twice, the function should return `null`/`None`.
```

```if:csharp
`GetSlope` will take in two Point objects. If the line through the two points is vertical, or the two points are the same, return `null`.

The Point object:

~~~
public class Point : System.Object
{
  public double X;
  public double Y;
  
  public Point(double x, double y)
  {
    this.X = x;
    this.Y = y;
  }
  
  public override string ToString()
  {
    return $"({this.X}, {this.Y})";
  }
  
  public override bool Equals(object point)
  {
    // Typechecking
    if (point == null || point.GetType() != this.GetType())
    {
      return false;
    }
    
    return this.ToString() == point.ToString();
  }
}
~~~

```

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Graph algorithms

Geometry

Mathematics

Matrices

Starter code: def getSlope(p1, p2):
	

Solutions:
def getSlope(p1, p2):
	return None if p1[0] == p2[0] else (p2[1] - p1[1]) / (p2[0] - p1[0])


def getSlope(p1, p2):
	if p2[0] - p1[0]:
		return (p2[1] - p1[1]) / (p2[0] - p1[0])


def getSlope(p1, p2):
	if not p2[0] - p1[0]:
		return None
	return (p2[1] - p1[1]) / (p2[0] - p1[0])


def getSlope(p1, p2):
	if p1[0] == p2[0] or p1 == p2:
		return None
	return (p1[1] - p2[1]) / (p1[0] - p2[0])


def getSlope(p1, p2):
	(p1x, p1y) = p1
	(p2x, p2y) = p2
	try:
		return (p2y - p1y) / (p2x - p1x)
	except:
		pass


def getSlope(p1, p2):
	try:
		slope = (p2[1] - p1[1]) / (p2[0] - p1[0])
		if p1 == p2:
			return None
		return slope
	except ZeroDivisionError:
		return None


def getSlope(p1, p2):
	try:
		return (p2[1] - p1[1]) / (p2[0] - p1[0])
	except:
		return None