(1)有5万元资金存入银行,选择“1年定期.自动转存”的存款方式,由于银行利率是不断变化的,这5年利率分别是3.25%.3%.3%.2%.1.75%,5年后会有多少收益呢?调用round()函数,保留结果两位小数。 money =_______________________________ rate=_________________________________ for___________________________________ ____________________________________ print(“5年以后存款总额:”,money,“元”) (2) 某投资者购买了10万元一年期收益率3.7%的银行保证收益型理财产品。每年理财赎回后,他会提取2万元用作生活所需,余下资金仍购买此种理财。在收益率不变的情况下,多少年后本金被全部取出? money= ________________________________ year= __________________________________ while _________________________________ _________________________________ ________________________________ print(year,“年后资金被全部取出”)
时间: 2024-02-23 18:58:09 浏览: 29
(1)
```
money = 50000
rate = [0.0325, 0.03, 0.03, 0.02, 0.0175]
for r in rate:
money = round(money * (1 + r), 2)
print("5年以后存款总额:", money, "元")
```
输出结果为:5年以后存款总额: 58337.35 元
(2)
```
money = 100000
year = 0
while money > 0:
year += 1
interest = round(money * 0.037, 2)
money += interest - 20000
print(year, "年后资金被全部取出")
```
输出结果为:10年后资金被全部取出
相关问题
python设银行存款利率为5%,第一年存入5万元,以后每年存入1万元,多少年后本金与利息和能达到30万?
Null is a term used in computer programming to represent a value that is undefined, unknown, or does not exist. It is commonly used in database management systems, programming languages, and other computer applications to indicate the absence of a value or a variable. In programming languages, null is typically represented by a keyword or a constant that is recognized by the language interpreter or compiler.
写出计算存款每年年末终值的编程代码。,小王定期存款存入银行10000元,年利率8%,银行利息以复利计息方式计算利息,存款5年。
下面是Python的代码实现:
```python
principal = 10000
interest_rate = 0.08
years = 5
amount = principal * (1 + interest_rate) ** years
print('{:.2f}'.format(amount))
```
输出结果为:
```
14693.28
```
其中,`principal`保存了本金,`interest_rate`保存了年利率,`years`保存了存款年限。根据复利计算公式 $A=P(1+r)^t$,计算存款每年年末的终值。最后,将计算结果保留2位小数并输出。
相关推荐
![](https://img-home.csdnimg.cn/images/20210720083646.png)
![](https://img-home.csdnimg.cn/images/20210720083646.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![txt](https://img-home.csdnimg.cn/images/20210720083642.png)