100일 간의 코드: 2022년을 위한 완전한 Python Pro 부트캠프 - 3일차(보물섬)
#🚨 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.")
운동 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.")
연습 3 - 윤년
#🚨 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.")
연습 4 - 피자 주문 실습
#🚨 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}")
연습 5 - 사랑 계산기
#🚨 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}.")
프로젝트 - 보물섬 시작
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.")
Reference
이 문제에 관하여(100일 간의 코드: 2022년을 위한 완전한 Python Pro 부트캠프 - 3일차(보물섬)), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/mike_kameta_aed62d48c2d0f/100-days-of-code-the-complete-python-pro-bootcamp-for-2022-day-3-2i82텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)