Merhaba arkadaşlar soru aşağıdaki gibi
Write a function that takes a dictionary, a key and a value and adds the key-value pair according to the following rules:
- if the key does not exist in the dictionary, then the key-value pair is added normally to the dictionary
- if the key already exists, and there is only one corresponding value of it
- then if the new value is different than the existing value, a list of the existing value and the new value is created and stored as the value of the key
- if the new value is the same as the existing value, then nothing is done
- if the key already exists, and there is a list of corresponding values
- if the new value is not contained in this value list, then it is added to the list,
- otherwise, nothing is done.
The function returns the updated dictionary.
The order of values in value lists must match the order they were inserted.
def multiAdd(dict, key, value):