Ad
Fundamentals
Algorithms
Logic

Kevin McCallister now grown and living in New York, is serving time on probation. He has an ankle monitor and can't be more than 2025m from his house. (That is a direct line from his house) He wanders around New York city blocks which are 80 meters North to South and 274 meters East to West. We need to know if Kevin is going to jail for violation of probation.
you will recieve a list of number of blocks travel in each direction and have to figure out if on his journey he ever ended up violating his 2000m distance(He can Travel 2000m but not anything more). Kevin checks his distance from home every few blocks. (assume he walked the blocks for check-in in the safest way to avoid going over 2000m)
each member of the list will be another list formatted as below were the number is the number of blocks traveled in that direction:

(#North,#East,#South,#West)
You will have at least 2 check in so list length >= 2
List will always be integers.

Your Result with return True is he ends up going to jail or False if he is safe to foil robbers another day.

def goesToJail(directions):
    location=[0,0]
    #North+East are postive numbers West+South are a negative numbers
    for direction in directions:
        location[0]=location[0]+(direction[0]*80)-(direction[2]*80)
        location[1]=location[1]+(direction[1]*274)-(direction[3]*274)
        #a squared + b squared = c squared
        if( (location[0]**2+location[1]**2)**(1/2) > 2000 ):
            return True
    return False