def merge(dict1,dict2):
    """
    Returns a new dictionary merging (joining keys) dict1
    and dict2.

    If a key appears in only one of dict1 or dict2, the
    value is the value from that dictionary. If it is in
    both, the value is the sum of values.

    Example: merge({'a':1,'b':2},{'b':3,'c':4}) returns
    {'a':1,'b':5,'c':4}

    Parameter dict1: The first dictionary to merge
    Precondition: dict1 a dictionary with int or float values

    Parameter dict2: The second dictionary to merge
    Precondition: dict2 a dictionary with int or float values
    """
    result = dict(dict1) # Makes a (shallow) copy
    for k in dict2:
        if k in dict1:
            result[k] = result[k]+1
        else:
            result[k] = 1
    return result