Write a function named safe_input(prompt,type) that works like the Python input function, except that it only accepts the specified type of input. The function takes two arguments:
• prompt: str• type: int, float, str
The function will keep prompting for input until correct input of the specified type is entered.
The function returns the input. If the input was specified to be a number (float or int), the value returned will be of the correct type; that is, the function will perform the conversion.
The default for a prompt is the empty string. The default for the type is string.
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.