Question: String color _ word has value 'magenta'. In the try block, integer string _ index is read from input. The character at string _ index

String color_word has value 'magenta'. In the try block, integer string_index is read from input. The character at string_index of color_word is output. Complete the following tasks:
Write an exception handler to catch ValueError and output 'int(): An integer is expected.'
Write an exception handler to catch IndexError and output 'String index should be between -7 and 6.'

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!