Exercise 1 - Odd or Even
#🚨 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.0
#🚨 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 Practise
#🚨 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 add_pepperoni == "Y":
if size == "S":
bill += 2
else:
bill += 3
if extra_cheese == "Y":
bill += 1
print(f"Your final bill is: ${bill}")
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:
print(f"Your score is {score}.")
Project - Treasure Island Start
print("Welcome to Treasure Island.")
print("Your mission is to find the treasure.")
#https://www.draw.io/?lightbox=1&highlight=0000ff&edit=_blank&layers=1&nav=1&title=Treasure%20Island%20Conditional.drawio#Uhttps%3A%2F%2Fdrive.google.com%2Fuc%3Fid%3D1oDe4ehjWZipYRsVfeAx2HyB7LCQ8_Fvi%26export%3Ddownload
#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.")
Top comments (0)