100일 간의 코드: 2022년을 위한 완전한 Python Pro 부트캠프 - 2일차(팁 계산기)
#🚨 Don't change the code below 👇
two_digit_number = input("Type a two digit number: ")
#🚨 Don't change the code above 👆
####################################
#Write your code below this line 👇
first_digit = two_digit_number[0]
second_digit = two_digit_number[1]
int_first_digit = int(first_digit)
int_second_digit = int(second_digit)
result = int_first_digit + int_second_digit
print(result)
연습 2 - BMI 계산기
#🚨 Don't change the code below 👇
height = input("enter your height in m: ")
weight = input("enter your weight in kg: ")
#🚨 Don't change the code above 👆
#Write your code below this line 👇
bmi = int(weight) / float(height) **2
bmi_int = int(bmi)
print(bmi_int)
연습 3 - 몇 주 동안의 삶
#🚨 Don't change the code below 👇
age = input("What is your current age?")
#🚨 Don't change the code above 👆
#Write your code below this line 👇
days = 90 * 365 - int(age) * 365
weeks = 90 * 52 - int(age) * 52
months = 90 * 12 - int(age) * 12
print(f"You have {days} days, {weeks} weeks, and {months} months left.")
프로젝트 2일 차 - 팁 계산기
#If the bill was $150.00, split between 5 people, with 12% tip.
#Each person should pay (150.00 / 5) * 1.12 = 33.6
#Format the result to 2 decimal places = 33.60
#Tip: There are 2 ways to round a number. You might have to do #some Googling to solve this.💪
#Write your code below this line 👇
print("Welcome to the tip calculator")
bill = int(input("How much is your bill? $ "))
tip = int(input("How much tip do you want to leave? 10, 12 or 15 percent? "))
people = int(input("How many people will split the bill? "))
bill_with_tip = tip / 100 * bill + bill
split = (bill_with_tip / people)
#Note - The round function did not produce the result asked so had #to change it the below. Thank you google lol
total_bill_split = "{:.2f}".format(split)
print(f"Each person should pay ${total_bill_split} ")
Reference
이 문제에 관하여(100일 간의 코드: 2022년을 위한 완전한 Python Pro 부트캠프 - 2일차(팁 계산기)), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/mike_kameta_aed62d48c2d0f/100-days-of-code-the-complete-python-pro-bootcamp-for-2022-day-2-71f텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)