Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- num_list = [1, 5, 4, 3, 45, 45, 47, 1, 2, 2]
- my_dict = {}
- for elem in num_list:
- if elem in my_dict:
- my_dict[elem] += 1
- else:
- my_dict[elem] = 1
- for key, value in my_dict.items():
- print('number',str(key),'appeared', str(value), 'time(s)')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement