1. 문제
for 반복문을 이용한 복리 계산기
2. 사용함수
3. 실행
|
price = int(input('금액 입력:'))
percent = float(input('이율 입력:'))
year = int(input('기간 입력:'))
targetMoney = price
for i in range(year):
targetMoney = targetMoney + targetMoney * percent * 0.01
print('-'*30)
print('이율:{}%'.format(percent))
print('원금:{}원'.format(format(price, ',')))
print('{}년 후 금액: {}원'.format(year, format(int(targetMoney), ',')))
print('-'*30)
|
4. 결과물
'Coding test > Python 기초문제' 카테고리의 다른 글
[for 반복문] 합, 짝수합, 홀수합, 팩토리얼 구하기 (0) | 2022.04.27 |
---|---|
[%, // 연산자] 빵과 우유 배분하기 (0) | 2022.04.17 |
[if/elif 조건문] 성적표 출력하기 (1) | 2022.04.16 |
[while 반복문] 거스름돈 계산기 (0) | 2022.04.16 |
[if~else 조건문] 100살 계산기 (0) | 2022.04.16 |