Review the code snippet below maritalStatus inputEnter your
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\" :
Solution
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\":
