You are given a list of directions in the form of a list:
goal = ["N", "S", "E", "W"]
Pretend that each direction counts for 1 step in that particular direction.
Your task is to create a function called directions, that will return a reduced list that will get you to the same point.The order of directions must be returned as N then S then E then W.
If you get back to beginning, return an empty array.
def directions(goal):
    count = lambda s: len([c for c in goal if c == s])
    ns = 1 * count("N") - 1 * count("S")
    we = 1 * count("W") - 1 * count("E")
    ns = [("N" if ns > 0 else "S")] * abs(ns)
    we = [("W" if we > 0 else "E")] * abs(we)
    return ns + we

def directions(goal):
    count = lambda s: len([c for c in goal if c == s])
    ns = 1 * count("N") - 1 * count("S")
    we = 1 * count("W") - 1 * count("E")
    ns = [("N" if ns > 0 else "S")] * abs(ns)
    we = [("W" if we > 0 else "E")] * abs(we)
    return ns + we
