Python | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

Python

Each coffee option has its own number, starting with 0. Write a program that will take a number from the customer as input from the customer and serve the corresponding coffee type. If the customer enters a number that is out of the accepted range, the program should output "Invalid number". Regardless of coffee option result, the program should output "Have a good day" at the end.  Sample Input 7  Sample Output Invalid number Have a good day. coffee = ["Café Latte", "Caffe Americano", "Espresso", "Cappuccino", "Macchiato"] choice = int(input()) try: #your code goes here print(coffee[choice]) except: print("Invalid number") finally: print("Have a good day") I need some explanation. I will be very thankful if SoloLearn community help me through this code I had used if, elif else statement but SoloLearn didn't accept it

6th Aug 2022, 11:06 AM
Nomeena Abbasi
Nomeena Abbasi - avatar
1 Antwort
+ 1
Thanks for including your code. What exactly is your queation here?
6th Aug 2022, 11:46 AM
Slick
Slick - avatar