# In the previous lesson, you used if-elif-else statements to create a menu based program.
# Now let us take a look at using nested if-elif statements in creating menu based programs.
''' Task 1: Booking a Ride'''
print("**** Task 1: ****")
print()
# How do you like travelling - by road or air?
# Do you know what information you need to give to the person booking your tickets?
# Some of the basic information you have to give are - date of travel, start location, destination etc.
# Let's write a “Booking a Ride” program that takes these basic information to book tickets.
print("Welcome! Let's book a ride for your next trip!\n Just note that you must travel by air if it is an international trip\ndue to our website's legal allowances.")
country1 = input("What country are you starting from?")
city1 = input("What city are you starting from?")
country2 = input("What country would you like to reach ?")
city2 = input("What city would you like to reach?")
month1 = input("What month would you like to leave in?")
day1 = int(input("What is the date you would like to leave on?"))
month2 = input("What month would you like to return in?")
day2 = int(input("What is the date you would like to return on?"))
if country1!=country2:
print("You must travel by air.")
else:
print("You can travel by air or road.\n")
travel = int(input("Would you like to travel by 1 - air or 2 - road. \nEnter the corresponding number"))
if travel == 1:
print("You would like to travel by air? Great!")
time = int(input("What time of day would you like to leave at?\n1-Morning\n2-Afternoon\n3-Evening\n4-Night\nPlease enter the corresponding number."))
if time == 1:
exact=int(input("Now, would you like \n1-The first flight at 8:30AM\n2-The second flight at 10:15AM\n3-The third flight at 11:45AM"))
if exact == 1:
print(f"Congratulations! You have booked your flight successfully! Here are your details:\n Date:{month1} {day1} Departure: 8:30AM\n Start:{City1},{Country1} Destination:{City2},{Country2}\n Return Flight:Date:{month2} {day2} Departure: 8:30AM\n Start:{City2},{Country2} Destination:{City1},{Country1}")
''' Task 2: Metric Converter'''
print("**** Task 2: ****")
print()
# Write a Metric Conversion program that converts from one metric to another metric.
# You can start with:
# 1. cm to inch (Hint: divide the cm value by 2.54)
# 2. inch to feet (Hint: divide the inch value by 12)
# 3. meter to kilometer (Hint: divide the meter value by 1000)
# You can add more to the list.
print("Welcome to the metric converter")
'''Brilliant!! You have successfully used nested if statements to create menu based programs. Now you are all set to take any challenge!! Kudos!'''
To embed this project on your website, copy the following code and paste it into your website's HTML: