Loading...
Loading...
A system holds these orders: 101 costs 2500, 102 costs 1800, 103 costs 999. The first line is the number m of lookups. The next m lines are order ids typed as text.
For each id print Order <id>: <amount>. If the text is not a whole number print Invalid id. If there is no such order print Order not found. After all lookups print Checked <m> ids. Count each lookup inside a finally block.
Checked <m> ids.Example
Input
3 101 abc 105
Output
Order 101: 2500 Invalid id Order not found Checked 3 ids
One found, one invalid, one missing.
Try the problem first. Open one hint at a time.
Convert the text with int() and look up the dictionary in the same try. ValueError and KeyError need different except blocks.
A finally block runs for every lookup, so a counter increased there counts all of them.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor