Browse Source

day 3

master
Ken Schaefer 1 year ago
commit
cd6dd2674a
  1. 17
      day-03/bmi-calculator-2.py
  2. 15
      day-03/leap-year.py

17
day-03/bmi-calculator-2.py

@ -0,0 +1,17 @@
# Enter your height in meters
height = float(input())
# Enter your weight in kilograms
weight = int(input())
bmi = weight / (height * height)
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.")

15
day-03/leap-year.py

@ -0,0 +1,15 @@
# Which year do you want to check?
year = int(input())
# My solution (same as hers)
if year % 4 == 0:
if year % 100 == 0:
if(year % 400 == 0):
print(f"{year} is a Leap Year")
else:
print(f"{year} is NOT a Leap Year")
else:
print(f"{year} is a Leap Year")
else:
print(f"{year} is NOT a Leap Year")
Loading…
Cancel
Save