Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Please write the follwing Python 3 Program. 2. Also, show all output. 3. I ha

ID: 3794825 • Letter: 1

Question

1. Please write the follwing Python 3 Program.

2. Also, show all output.

3. I have also left an example of the mailbox program below that need sot be modified.

Improving input

The input() function can generate two exceptions: EOFError or KeyboardInterrupt on end-of-file(EOF) or canceled input.

Create a wrapper function, perhaps safe_input() that returns None rather rather than raising these exceptions, when the user enters ^C for Keyboard Interrupt, or ^D (^Z on Windows) for End Of File.

Update your mailroom program to use exceptions (and IBAFP) to handle malformed numeric input

Mailbox Program Example:

----------------------------------------------------------------------------------------------------------------------------------------------------------------------

output:

Explanation / Answer

wrapper function:

Add this function to the above code and replace all input() with safe_input().

def safe_input(prompt):
try:
value_str = input( prompt )
except (ValueError,EOFError,KeyboardInterrupt):
return None
return value_str