Question: Dictionary num _ to _ word contains key - value pairs 9 . 0 : 'nine point zero', 8 . 5 : 'eight point five',
Dictionary numtoword contains keyvalue pairs : 'nine point zero', : 'eight point five', : 'seven point five', and : 'five point five'. In the try block, float numkey is read from input. The keyvalue pair with numkey as the key is deleted from numtoword. Complete the following tasks:
Write an exception handler to catch ValueError and output 'float: A float is expected.
Write an exception handler to catch KeyError and output 'numkey cannot be deleted from numtoword.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
