https://school.programmers.co.kr/learn/courses/30/lessons/120818
def solution(price):
discount = 0
if price >= 500000:
discount = 20
elif price >= 300000:
discount = 10
elif price >= 100000:
discount = 5
else:
return price
answer = price - (price * discount // 100)
return answer
def solution(price):
if price >= 500000:
answer = price * .80
elif price >= 300000:
answer = price * .90
elif price >= 100000:
answer = price * .95
else:
answer = price
return int(answer)
0.8
처럼 계산해주었다.0
인 실수는 .95
와 같이 표현할 수 있음을 다시 한 번 확인하자.int()
형 변환하는 점, 문제 조건을 보고 실제 테스트에서는 한 번 더 확인하자.피드백은 언제나 환영입니다 :)