question archive Write a Python program in which the user enters either 'A', 'B', or 'C'

Write a Python program in which the user enters either 'A', 'B', or 'C'

Subject:Computer SciencePrice:2.89 Bought3

Write a Python program in which the user enters either 'A', 'B', or 'C'. If 'A' is entered, the program should display the word 'Apple'; if 'B' is entered, it displays 'Banana'; and if 'C' is entered, it displays 'Coconut'. Use nested if statements for this as depicted in Figure 3-13.

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE

Answer Preview

ch = raw_input("Please enter a character. \n")

 

if ch == "A":

print("Apple")

else:

if ch == "B":

print("Banana")

else:

if ch == "C":

print("Coconut")