23.5k views
0 votes
1. Complete the following code by taking input from the user for the variables gender. If the user’s gender choice is: a. "Female" tell them "Option 5" b. "Male", tell them "Option7" c. if they enter something different altogether tell them "Option 9 " (10 points)

1 Answer

7 votes

Answer:

The solution code is written in Python 3

  1. gender = input("Enter your gender choices (a. Female b. Male)")
  2. if(gender == "a"):
  3. print("Option 5")
  4. elif(gender == "b"):
  5. print("Option 7")
  6. else:
  7. print("Option 9")

Step-by-step explanation:

Firstly, we can use the input function to prompt user to input their gender choice (Line 1).

Since there are three possibilities how user can give their gender input, we use if-else-if statements to check the input gender choice. If the choice is "a", show "Option 5", if "b" shows "Option 7" and if something else show "Option 9"

User Pavel Smirnov
by
4.0k points