filmov
tv
Code 86: TCS NQT - FULLY AUTOMATIC VENDING MACHINE Problem using Python | TCS NQT | 365 Days of Code
![preview_player](https://i.ytimg.com/vi/ElM8JzcCMgo/maxresdefault.jpg)
Показать описание
# You can read the question in description
"""
Problem Statement
FULLY AUTOMATIC VENDING MACHINE – dispenses your cuppa on just press of button. A vending machine can serve range of products as follows:
Coffee
1. Espresso Coffee
2. Cappuccino Coffee
3. Latte Coffee
Tea
1. Plain Tea
2. Assam Tea
3. Ginger Tea
4. Cardamom Tea
5. Masala Tea
6. Lemon Tea
7. Green Tea
8. Organic Darjeeling Tea
Soups
1. Hot and Sour Soup
2. Veg Corn Soup
3. Tomato Soup
4. Spicy Tomato Soup
Beverages
1. Hot Chocolate Drink
2. Badam Drink
3. Badam-Pista Drink
Write a program to take input for main menu & sub menu and display the name of sub menu selected in the following format (enter the first letter to select main menu):
Welcome to CCD
Enjoy your
Example 1:
Input:
c
1
Output:
Welcome to CCD!
Enjoy your Espresso Coffee!
Example 2:
Input
t
9
Output
INVALID OUTPUT!
"""
coffee = ['Espresso Coffee','Cappuucino Coffee','Latte Coffee']
tea = ['Plain Tea', 'Assam Tea','Ginger Tea','Cardamom Tea','Masala Tea','Lemon Tea','Green Tea','Organic Darjeeling Tea']
soup = ['Hot and Sour Soup','Veg Corn Soup','Tomato Soup','Spicy Tomato Soup']
drink = ['Hot Chocolate Drink', 'Badam Drink','Badam-Pista Drink']
menu = input()
item_number = int(input())
if menu == "c":
if item_number <= len(coffee):
print("Welcome to CCD!")
print("Enjoy your "+coffee[item_number-1])
else:
print("INVALID INPUT")
elif menu == "t":
if item_number <= len(tea):
print("Welcome to CCD!")
print("Enjoy your "+tea[item_number-1])
else:
print("INVALID INPUT")
elif menu == "s":
if item_number <= len(soup):
print("Welcome to CCD!")
print("Enjoy your "+soup[item_number-1])
else:
print("INVALID INPUT")
elif menu == "d":
if item_number <= len(drink):
print("Welcome to CCD!")
print("Enjoy your "+drink[item_number-1])
else:
print("INVALID INPUT")
else:
print("INVALID INPUT")
# Thank
"""
Problem Statement
FULLY AUTOMATIC VENDING MACHINE – dispenses your cuppa on just press of button. A vending machine can serve range of products as follows:
Coffee
1. Espresso Coffee
2. Cappuccino Coffee
3. Latte Coffee
Tea
1. Plain Tea
2. Assam Tea
3. Ginger Tea
4. Cardamom Tea
5. Masala Tea
6. Lemon Tea
7. Green Tea
8. Organic Darjeeling Tea
Soups
1. Hot and Sour Soup
2. Veg Corn Soup
3. Tomato Soup
4. Spicy Tomato Soup
Beverages
1. Hot Chocolate Drink
2. Badam Drink
3. Badam-Pista Drink
Write a program to take input for main menu & sub menu and display the name of sub menu selected in the following format (enter the first letter to select main menu):
Welcome to CCD
Enjoy your
Example 1:
Input:
c
1
Output:
Welcome to CCD!
Enjoy your Espresso Coffee!
Example 2:
Input
t
9
Output
INVALID OUTPUT!
"""
coffee = ['Espresso Coffee','Cappuucino Coffee','Latte Coffee']
tea = ['Plain Tea', 'Assam Tea','Ginger Tea','Cardamom Tea','Masala Tea','Lemon Tea','Green Tea','Organic Darjeeling Tea']
soup = ['Hot and Sour Soup','Veg Corn Soup','Tomato Soup','Spicy Tomato Soup']
drink = ['Hot Chocolate Drink', 'Badam Drink','Badam-Pista Drink']
menu = input()
item_number = int(input())
if menu == "c":
if item_number <= len(coffee):
print("Welcome to CCD!")
print("Enjoy your "+coffee[item_number-1])
else:
print("INVALID INPUT")
elif menu == "t":
if item_number <= len(tea):
print("Welcome to CCD!")
print("Enjoy your "+tea[item_number-1])
else:
print("INVALID INPUT")
elif menu == "s":
if item_number <= len(soup):
print("Welcome to CCD!")
print("Enjoy your "+soup[item_number-1])
else:
print("INVALID INPUT")
elif menu == "d":
if item_number <= len(drink):
print("Welcome to CCD!")
print("Enjoy your "+drink[item_number-1])
else:
print("INVALID INPUT")
else:
print("INVALID INPUT")
# Thank
Комментарии