* 공부 필기 내용을 업로드한 것입니다 (수업 내용과 차이가 있을 수 있음)
18. 파이썬의 기본 데이터 형식
print(789_943)
- 밑줄은 큰 수를 쉽게 읽을 수 있도록 하기 위한 용도
- 789_943를 print 하면 789943이 된다
22. [대화형 코딩 연습] BMI 계산기
height = input("enter your height in m: ")
weight = input("enter your weight in kg: ")
# bmi=round(float(weight)/(float(height)**2))
bmi=int(float(weight)/(float(height)**2))
print(bmi)
23. 파이썬의 숫자 처리 및 F-String
score = 0
# score=score+1
score += 1
score = 0
height = 1.8
isWinning = True
print(f"your score is {score}, your height is {height}, you are winning is {isWinning}")
24. [대화형 코딩연습] 삶을 주week로 표현해보기
- 90살까지 산다고 가정
- There are 365 days in a year, 52 weeks in a year and 12 months in a year.
age = input("현재 나이를 입력해주세요: ")
left_years = 90 - int(age)
days = left_years * 365
weeks = left_years * 52
months = left_years * 12
print(f"You have {days} days, {weeks} weeks, and {months} months left.")
# Angela_가독성을 위해
# message=f"You have {days} days, {weeks} weeks, and {months} months left."
# print(message)
25. 2일차 프로젝트: 팁 계산기
print("Welcome to the tip calculator!")
total_bill = float(input("What was the total bill? $"))
tip = int(input("How much tip would you like to give? 10, 12, or 15? "))
people_num = int(input("How many people to split the bill? "))
each_pay = round((total_bill / people_num) * (1 + 0.01 * tip), 2)
print("Each person should pay: $", each_pay)
'Development > Python' 카테고리의 다른 글
Test-time-computing에 대하여 (허깅페이스 블로그 포스트 정리) (0) | 2025.03.27 |
---|---|
[코딩테스트#1] 기초 자료 구조: 배열, 문자열, 스택, 큐 (1) | 2024.06.23 |
[파이썬 부트캠프 #1] 파이썬 변수를 사용한 데이터 관리 (0) | 2023.07.28 |