Question: 7 . 3 3 LAB: yes no validation Instructions Write a validation kop that will check that the user typed either 'yes. no
LAB: yes no validation
Instructions
Write a validation kop that will check that the user typed either 'yes". no or just the letteryor n The answer can be uppercase.
kwercase, or any combination.
You are required to use a while kop. You may NOT use a "fake do while" loop with break.
Examples of valid input:
y Y yes Yes YES YEs YeS yES yEs yeS
n N no No NO nO oN
Examples of expected output:
Please enter yes or no: yes
You entered yes
Note that the answer gets converted to kwercase.
Please enter yes or no: No
You entered no
Note that is treated as a yes.
Please enter yes or no: Y
You entered yes
Invalid input is rejected and the program keeps asking for walid input.
Please enter yes or no: banana
invalid input
Please enter yes or no: shoes
invalid input
Please enter yes or no:
invalid input
Please enter yes or no: Yea Yea is not Yes!
invalid input
Please enter yes or no: No
You entered no
Helpfol Hints
Look up the kwer function for strings.
The expression foo gives you the first character of the string foo.
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
