Linux‎ > ‎

A Short and Simple Python Script

posted Dec 2, 2017, 5:58 PM by Ali Janah
# file: App.py
name = input("Hello, what's your name?: ")
print("Hello, " + name + ", and welcome!")
#Taking an integer value and assigning it to the service variable for later use
service = int(input("Now please take a sit and tell me how many guests are you bringing with you tonight?: "))
#Making a condition to define if the subjects will be plural or singular
if service > 1:
    invitee = " guests"
    table = " them."
    clients = " all"
else:
    invitee = " guest"
    table = " the both of you."
    clients = " the both"
print("Oh, " + str(service) + invitee + "..., then I shall prepare a table for" + table)
menu = ["Salad", "Sandwich", "Tiramisu"]
print("In regards to your order, we have " + str(len(menu)) + " specialities today !")
choice = input("What will you begin with, " + menu[0] + ", " + menu[1] + " or " + menu[2] + " ?")
#Add code to accept only the available menu choices
print("So " + choice + " for" + clients + " of you")
ċ
App.py
(1k)
Ali Janah,
Dec 2, 2017, 5:58 PM
Comments