The following function is intended to check if two geographic points are close
to one another. If they are it should return True
. If they aren’t, it should
return False
. Two points are considered near to each other if the absolute
value of the difference in their latitudes is less than one and the absolute
value of the difference in their longitudes is less than one. Fill in the
_________
in the function to make it work and then use it to check if the
following pairs of points are near or not and print out the answers.
def near(lat1, long1, lat2, long2):
"""Check if two geographic points are near each other"""
if (abs(lat1 - lat2) < 1) and (_________):
near = True
else:
near = _________
return near