# Author: Scott Wehrwein
# Date: 04/30/2021
# A function to compute the midpoint between two points.

import math

def midpoint(p1, p2):
    """ Return the midpoint between p1 and p2,
        points with coordinates (p1x, p1y) and (p2x, p2y)
        Pre: p1 and p2 are 2-tuples
    """
    p1x, p1y = p1
    p2x, p2y = p2
    
    mid_x = (p1x + p2x) / 2
    mid_y = (p1y + p2y) / 2
    
    return (mid_x, mid_y)




# Test cases - they should all print True
print("midpoint tests:")
print(midpoint((0,0), (1,1)) == (0.5, 0.5))
print(midpoint((1,1), (3,3)) == (2, 2))
print(midpoint((3,3), (1,1)) == (2, 2))
