ramsess90

03. Count Numbers from Lists - Exercises

Jan 24th, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.24 KB | None | 0 0
  1. nums_list = list(map(int, input().split(' ')))
  2.  
  3. nums_dict = {}
  4. for num in sorted(nums_list):
  5.     if num not in nums_dict:
  6.         nums_dict[num] = nums_list.count(num)
  7.  
  8. for key, value in nums_dict.items():
  9.     print(f'{key} -> {value}')
Advertisement
Add Comment
Please, Sign In to add comment