# What do you do when you have to place an order in a restaurant?
# Just the way you get options to choose from a menu card, in the same way you can write programs that give options for a user to choose from.
# Let's take a look.
'''Task 1: Perimeter Calculator'''
print()
print("****Task 1: *****")
# Given below is a menu based Perimeter calculator.
# The calculator calculates the perimeter of:
# - rectangle [Formula: 2*(length+width)]
# - square [Formula: 4*length of side]
# - circe[Formula: 2*(3.14*radius)]
# - triangle [Formula: length + base + side]
# The menu has been created for you.
# Uncomment the statements and for each of the if statements write the relevant code.
print("***** Perimeter Calculator *****")
print("Select the shape for which the perimeter needs to be calculated")
print("1. Rectangle")
print("2. Square")
print("3. Circle")
print("4. Triangle")
per = 0
choice=int(input("Enter your choice: "))
if choice==1:
l = int(input("Enter the length of the rectangle:\n"))
w = int(input("Enter the width of the rectangle:\n"))
per = 2*(l+w)
print(f"The rectangle's perimeter is {per}")
elif choice==2:
l = int(input("Enter the length of a side of the square:\n"))
per = l*4
print(f"The square's perimeter is {per}")
elif choice==3:
r = int(input("Enter the radius of the circle:"))
per = float(per)
per = r * 2 * 3.14
print(f"The circle's perimeter is {per}")
elif choice==4:
l = int(input("Enter the length of the base of the triangle:\n"))
w = int(input("Enter the length of the triangle's second side:\n"))
b = int(input("Enter the length of the triangle's third side:\n"))
per = l+w+bool
print(f"The triangle's perimeter is {per}")
else:
print("Try again and enter one of the numbers mentioned above.")
'''Task 2: Good Morning'''
print()
print("****Task 2: *****")
# How do you wish a person when you get up in the morning?
# Want to try writing a program that can wish a person “Good Morning” in a language other than english?
# Go ahead and write a program where one can select the language to wish Good morning. You can start with these options:
# English - Good Morning!
# Italian - Buongiorno!
# Spanish - Buenos Dias!
# German - Guten morgen!
# Quit
print("Welcome! Enter the number corresponding to a language.\n Then, this program will tell you how to say good morning in that language.")
print("Here is the number chart for languages and there corresponding number:\nGerman - 1\nEnglish - 2\nItalian - 3\nSpanish - 4\n")
num = int(input("Please enter your chosen number:\n"))
if num == 1:
print("Guten morgen!")
elif num == 2:
print("Good Morning!")
elif num == 3:
print("Buongiorno!")
elif num == 4:
print("Buenos Dias!")
else:
print("Please use one of the numbers mentioned above.")
'''Task 3: Country and Capital'''
print()
print("****Task 3: *****")
# Have you visited different states/countries? Can you name some?
# Of the different states and countries you have visited, can you tell me their capital?
# Let's write a menu driven program that gives the capital of the country/state selected.
# You can start with the list below:
# 1. Bhutan - Thimphu
# 2. Canada - Ottawa
# 3. France - Paris
# 4. Germany - Berlin
# 5. India - New Delhi
# 6. Malaysia - Kuala Lumpur
# 7. Nepal - Kathmandu
# 8. South Korea - Seoul
# 9. Sweden - Stockholm
# 10. Poland - Warsaw
print("Choose a number corresponding to a country and this machine will tell you that country's capital\nBhutan - 1\nCanada - 2\nFrance - 3\nGermany - 4\nIndia - 5\nMalaysia - 6\nNepal - 7\nSouth Korea - 8\nSweden - 9\nPoland - 10\n")
num = int(input("Please enter your chosen number:\n"))
if num == 1:
print("Bhutan - Thimphu")
elif num == 2:
print("Canada - Ottawa")
elif num == 3:
print("France - Paris")
elif num == 4:
print("Germany - Berlin")
elif num == 5:
print("India - New Delhi")
elif num == 6:
print("Malaysia - Kuala Lumpur")
elif num == 7:
print("Nepal - Kathmandu")
elif num == 8:
print("South Korea - Seoul")
elif num == 9:
print("Sweden - Stockholm")
elif num == 10:
print("Poland - Warsaw")
else:
print("Please use one of the numbers mentioned above.")
'''Great! You are really getting the hang of writing menu based programs. Way to go!!'''
To embed this project on your website, copy the following code and paste it into your website's HTML: