- #d = {1:1, 2:2, 3:3, 4:3, 5:3}
- def keysWithValue(aDict, target):
- '''
- aDict: a dictionary
- target: an integer
- '''
- # Your code here
- ans = []
- for k, v in aDict.items():
- if v == target:
- ans.append(k)
- return sorted(ans)
- #print(keysWithValue(d, 3))
Raw Paste