mikekameta

Posted on

# 100 Days of Code: The Complete Python Pro Bootcamp for 2022 - Day 3 (Treasure Island)

Exercise 1 Odds and Evens

``````#ðŸš¨ Don't change the code below ðŸ‘‡
number = int(input("Which number do you want to check? "))
#ðŸš¨ Don't change the code above ðŸ‘†

#Write your code below this line ðŸ‘‡
if number % ) == 0:
print("This is an even number")
else:
print("This is an odd number.")
``````

Exercise 2 BMI 2

``````#ðŸš¨ Don't change the code below ðŸ‘‡
height = float(input("enter your height in m: "))
weight = float(input("enter your weight in kg: "))
#ðŸš¨ Don't change the code above ðŸ‘†

#Write your code below this line ðŸ‘‡
bmi = round(weight / height **2)
if bmi < 18.5:
print(f"Your BMI is {bmi}, you are underweight.")
elif bmi < 25:
print(f"Your BMI is {bmi}, you have a normal weight.")
elif bmi < 30:
print(f"Your BMI is {bmi}, you are slightly overweight.")
elif bmi < 35:
print(f"Your BMI is {bmi}, you are obese.")
else:
print(f"Your BMI is {bmi}, you are clinically obese.")
``````

Exercise 3 Leap Year

``````#ðŸš¨ Don't change the code below ðŸ‘‡
year = int(input("Which year do you want to check? "))
#ðŸš¨ Don't change the code above ðŸ‘†

#Write your code below this line ðŸ‘‡
if year % 4 == 0:
print("Leap year.")
elif year % 100 == 0:
print("Not leap year.")
elif year % 400 == 0:
print("Leap year.")
else:
print("Not leap year.")
``````

Exercise 4 Pizza Order

``````#ðŸš¨ Don't change the code below ðŸ‘‡
print("Welcome to Python Pizza Deliveries!")
size = input("What size pizza do you want? S, M, or L ")
add_pepperoni = input("Do you want pepperoni? Y or N ")
extra_cheese = input("Do you want extra cheese? Y or N ")
#ðŸš¨ Don't change the code above ðŸ‘†

#Write your code below this line ðŸ‘‡

bill = 0

if size == "S":
bill += 15
elif size == "M":
bill += 20
else:
bill += 25

if size == "S":
bill += 2
else:
bill += 3

if extra_cheese == "Y":
bill += 1

``````

Exercise 5 Love Calculator

``````#ðŸš¨ Don't change the code below ðŸ‘‡
print("Welcome to the Love Calculator!")
name1 = input("What is your name? \n")
name2 = input("What is their name? \n")
#ðŸš¨ Don't change the code above ðŸ‘†

#Write your code below this line ðŸ‘‡

combined_names = name1 + name2
lower_names = combined_names.lower()
t = lower_names.count("t")
r = lower_names.count("r")
u = lower_names.count("u")
e = lower_names.count("e")
first_digit = t + r + u + e

l = lower_names.count("l")
o = lower_names.count("o")
v = lower_names.count("v")
e = lower_names.count("e")
second_digit = l + o + v + e

score = int(str(first_digit) + str(second_digit))

if (score < 10) or (score > 90):
print(f"Your score is {score}, you go together like coke and mentos.")
elif (score >= 40) and (score <= 50):
print(f"Your score is {score}, you are alright together.")
else:
``````

Project 3 Treasure Island Start

``````print("Welcome to Treasure Island.")
print("Your mission is to find the treasure.")

#Write your code below this line ðŸ‘‡

option1 = input("You're path comes to a cross road. Which way will you go? Type left or right? \n").lower()
if option1 == "left":
option2 = input("You've arrived at the edge of a lake. There is an island in the middle. Do you wait for a boat or swim to the island? Type wait or swim \n").lower()
if option2 == "wait":
option3 = input("You arrive on the island and walk up to a house with 3 coloured doors. Which door do you open? red yellow or blue? \n").lower()
if option3 == "yellow":
print("Congratulations....You found the treasure, may the force be with you")
elif option3 == "red":
print("Burnt by fire. Game Over.")
elif option3 == "blue":
print("The room is full of beasts. Game Over.")
else:
print("You've chosen the wrong door. Game Over.")
else:
print("Attacked by trout. Game Over.")
else:
print("You've fallen into a hole. Game Over.")
``````