#7.1 car tental
car = input("What brand of car would you like to rent?")
print("\nLet me see if I can find you a " + car + ".")
#7.2 reservation of diner
number_of_people = input("How many people would you like to come together?")
number_of_people = int(number_of_people)
if number_of_people > 8:
print("Sorry, there is no vacant table available for you now.")
else:
print("Congratulation! You can reserve a table for your meal")
#7.3 10 multiple
number = int(input("Please enter a number and I will check if it is the multiple of 10: "))
if number % 2 == 0:
print("Yes, " + str(number) + " is the multiple of 10")
else:
print("No, " + str(number) + " is not the multiple of 10")
#7.4 ingredients of pizza
prompt = '\nPlease select the ingredient you want!'
prompt += '\nEnter "quit" when you are finished.'
active = True
while active:
ingredient = input(prompt)
if ingredient == "quit":
break
else:
print("We will add your " + str(ingredient) + " to your pizza!")
#7.5 tickets of cinema
age = ""
active = True
while age != 'quit':
age = input('Hello, please enter your age: ')
if age == 'quit':
active = False
elif int(age) < 3:
print('Your ticket is $0.')
elif int(age) <= 12:
print('Your ticket is $10.')
elif int(age) > 12:
print('Your ticket is $15.')
#7.6 three ways:
age = ''
active = True
while active:
age = int(input("Please enter your age: "))
if age == "quit":
break
elif age < 3:
print("You are free to enjoy the movie")
elif 3 < age < 12:
print("Your ticket is $10.")
else:
print("Your ticket is $15.")
#7.7 endless loop
x = 1
while x < 5:
print(x)
#7.8 grocery store
sandwich_orders = ['chicken sandwich', 'beef sandwich', 'lamb sandwich', 'pork sandwich']
finished_orders = []
while sandwich_orders:
sandwich = sandwich_orders.pop()
print("I made your " + sandwich.title())
finished_orders.append(sandwich)
print("\nFinished sandwich: ")
for finished_sandwich in finished_orders:
print(finished_sandwich.title())
#7.9 the pastrami is sold out
sandwich_orders = ['pastrami', 'chicken sandwich', 'beef sandwich',
'pastrami', 'lamb sandwich', 'pork sandwich', 'pastrami'
]
print("We're sorry to tell you that the pastrami sandwich is sold out.")
while 'pastrami' in sandwich_orders:
sandwich_orders.remove('pastrami')
finished_orders = sandwich_orders
print(finished_orders)
#7.10 the dreaming resorts
place_to_go = []
active = True
while active:
place = input("If you could visit one place in the world, where would you go? : ")
place_to_go.append(place)
ask = input("Keep investigating? (yes/no)")
if ask == 'no':
break
print(place_to_go)