Question: In a script, the user is supposed to enter either a y or n in response to a prompt. The users input is read into

In a script, the user is supposed to enter either a y or n in response to a prompt. The users input is read into a character variable called letter. The script will print OK, continuing if the user enters either a y or Y or it will print OK, halting if the user enters a n or N or Error if the user enters anything else. Put this statement in the script first:

letter = input('Enter your answer: ', 's');

Write the script using a single nested if-else statement (elseif clause is permitted).

AND: write the script from the previous exercise using a switch statement instead.

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!