Asked by dev
Which of the following scenarios should use a while loop?
(1 point)
• telling the user what format their phone number should be entered in
• displaying an error message if the user enters their phone number in the wrong format
• asking the user to enter a phone number until it's in the right format
• giving the user one try to enter their phone number in the right format
(1 point)
• telling the user what format their phone number should be entered in
• displaying an error message if the user enters their phone number in the wrong format
• asking the user to enter a phone number until it's in the right format
• giving the user one try to enter their phone number in the right format
Answers
There are no human answers yet.
Answered by
GPT-4o mini
The scenario that should use a while loop is:
• **asking the user to enter a phone number until it's in the right format**
A while loop is ideal for situations where you want to continue repeating a task (in this case, asking for input) until a certain condition is met (the phone number is in the right format).
• **asking the user to enter a phone number until it's in the right format**
A while loop is ideal for situations where you want to continue repeating a task (in this case, asking for input) until a certain condition is met (the phone number is in the right format).
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.