1 분 소요

##파이썬 프로젝트 3

홀수, 짝수 계산기

number = int(input("Which number do you want to check? "))
if number % 2 ==0:
  print("짝수")
else:
  print("홀수")

BMI Calcurator 2.0


height = float(input("enter your height in m: "))
weight = float(input("enter your weight in kg: "))

w = float(weight)
h = float(height) ** 2

BMI = float(w) / float(h)

float(BMI)

if float(BMI) <= 18.5:
  print(f"Your BMI is... {round(BMI,0)} you are underweight.")
elif float(BMI) <= 25:
  print(f"Your BMI is... {round(BMI,0)} you have a normal weight.")
elif float(BMI) <= 30:
  print(f"Your BMI is... {round(BMI,0)} you have a slightly overweight.")
elif float(BMI) <= 35:
  print(f"Your BMI is... {round(BMI,0)} obese.")
else:
  print(f"Your BMI is... {round(BMI,0)} clinically obese.")

윤년 계산기

year = int(input("Which year do you want to check? "))

if year %4 ==0:
  if year % 100== 0:
    if year % 400 ==0:
      print("leap year")
    else:
      print("not leap year")
  else:
    print("leap year.")
else:
  print("not leap year.")

피자값 계산기


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 ")

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

if add_pepperoni == "Y":
  if size == "S":
    bill += 2
  else:
    bill += 3
  
if extra_cheese == "Y":
  bill += 1

print(f"your bill is..{bill}")

TOSS 후원 카카오페이 후원

댓글남기기