Popping the losers

Report a typo

Imagine that you are a marketer who analyzes the commercial real estate market and makes a rating of construction companies. Names of the companies and their ratings are recorded in the descending order in the OrderedDict named firms. In total, there are five firms in the dictionary, and you want to only keep three of the most successful ones.

Please delete the last two items from the given OrderedDict, and print out the altered version.

Sample Input 1:

{"YourHouse": 9.5, "BrownBuildCo": 9.1, "Build in the City": 9.0, "mr.Stone & Co": 7.8, "Flinstones Appartment": 7.3}

Sample Output 1:

OrderedDict([('YourHouse', 9.5), ('BrownBuildCo', 9.1), ('Build in the City', 9.0)])
Write a program in Python 3
# the following line reads a dict from the input and converts it into an OrderedDict, do not modify it, please
firms = OrderedDict(json.loads(input()))

# your code here
___

Create a free account to access the full topic