Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import json
- a = json.loads(input())
- x = {}
- for item in a["response"]["items"]:
- if "bdate" not in item:
- continue
- mdy = item["bdate"].split(".")
- if len(mdy) == 3:
- year = int(mdy[2])
- age = 2018 - year
- if age in x:
- x[age] += 1
- else:
- x[age] = 1
- out = list(x.items())
- out.sort()
- print(sorted(out, key=lambda b: -b[1]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement