Question: we wish the user to enter a single digit, we may wish to prompt multiple times in order to arrive at a valid input. Use

we wish the user to enter a single digit, we may wish to prompt
multiple times in order to arrive at a valid input. Use the prompts shown in the sample
output below to arrive at a valid digit input.
get_digit Function:
Input variables:
none
Output variables:
a scalar value representing a single digit
A possible sample case is:
>> digit = get_digit()
Enter a digit: pi
Invalid input. Enter a digit: -1
Invalid input. Enter a digit: 10
Invalid input. Enter a digit: 5
digit =5
5

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 Databases Questions!