I am learning python and I have the following scenario: Create a data structure that associates two values. Then retrieve the specific data without using an if/else statement. This is what I came up with.
def menu():
print("1. fruit 1")
print("2. fruit 2")
print("3. fruit 3")
fruits = {
1: ["Fruit 1", "Message", "Healthy"],
2: ["Fruit 2", "Message", "Unhealthy"],
3: ["Fruit 3", "Message", "Healthy"]
}
menu()
option = int(input("Choose your fruit: ")
print(fruits.get(option))
This works but it prints out the brackets and quotation marks. How do I make it prettier? I've seen other examples but it usually only deals with a simple one line dictionary without user input. Any help is appreciated.