Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Review the code snippet below: maritalStatus = input(\"Enter your marital status

ID: 3930367 • Letter: R

Question

Review the code snippet below:


maritalStatus = input("Enter your marital status (s for single, m for married): ")
maritalStatus = maritalStatus.upper()
Which of the following statements can be used to validate whether the user entered a valid marital status?Question 3 options:


A)   

if maritalStatus == "S" or maritalStatus == "M" :

B)   

if maritalStatus == "s" or maritalStatus == "m" :

C)   

if (maritalStatus == "s" or maritalStatus == "m") and
(maritalStatus == "S" or maritalStatus == "M") :

D)   

if maritalStatus == "s" or "S" or "m" or "M" :


Explanation / Answer

A)

#get the input from user.

maritalStatus = input("Enter your marital status (s for single, m for married): ")

#convert the input to upper case.

maritalStatus = maritalStatus.upper()

# it would be enough to check in the upper case letters

# whether an input is valid or not.

if martialStatus == "S" or matrialStatus == "M":

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote