Login and get codingAnother real-world scenario: in this Bite you will parse a json output file with Bites scored at different dates (thanks Mockeroo). Given our ninja ranking you will return a
dict
of belts earned at (readable) dates.Complete
get_belts
below which receives the json file path string. The ninja ranking is wrapped in 2 lists you can use:SCORES
andBELTS
.Here is how it should work:
>>> from belts import get_belts >>> with open('bite_scores1.json') as f: ... print(f.readlines()[:5]) ... ['[{"date":"10/20/2019","score":1},\n', '{"date":"1/19/2019","score":1},\n', '{"date":"8/14/2018","score":1},\n', '{"date":"10/26/2019","score":4},\n', '{"date":"3/27/2019","score":1},\n'] >>> get_belts('bite_scores1.json') {'white': 'January 23, 2018', 'yellow': 'June 20, 2018', 'orange': 'October 07, 2018', 'green': 'April 08, 2019'}Have fun and keep calm and code in Python!
Will you be the 67th person to crack this Bite?
Resolution time: ~88 min. (avg. submissions of 5-240 min.)
Our community rates this Bite 5.33 on a 1-10 difficulty scale.
» Up for a challenge? 💪