학습목표:나이를 입력하면 남은 햇수를 주 단위로 출력해보기
참고자료: https://replit.com/@appbrewery/day-2-3-exercise / https://waitbutwhy.com/2014/05/life-weeks.html
Instructions
인간이 90세까지 운좋게 살 수 있다면, 실제로 몇일 몇주 몇달 남았는지 알려주는 프로그램을 만드시오
You have x days, y weeks, and z months left. # 이런 포맷으로 실행결과가 되어야 함.
Example Input
56
Example Output
You have 12410 days, 1768 weeks, and 408 months left.
Try it!
1. 오답. print()는 서로 다른 데이터형을 한번에 출력 불가
*concatenate : 결합하기
*input()함수로 저장한 데이터는 str타입이다!
# 🚨 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 👇
left_years = 90 - int(age)
left_days = left_years * 365
left_weeks = left_years * 52
left_months = left_years * 12
print("You have " + left_days + " days, " + left_weeks + " weeks", + "and " + left_months + " months left.")
# 🚨 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 👇
left_years = 90 - int(age)
left_days = left_years * 365
left_weeks = left_years * 52
left_months = left_years * 12
print("You have " + str(left_days) + " days, " + str(left_weeks) + " weeks, " + "and " + str(left_months) + " months left.")
#실행결과: what is your current age?25
You have 23725 days, 3380 weeks, and 780 months left.
#유데미 #유데미코리아 #스타트위드유데미 #스터디윗미