python 学习记录(4)—本金+利息计算及简单的游戏猜测程序

这篇博客记录了两个Python程序:一个用于计算不同利率下的本息和,另一个是简单的羽毛球比赛猜分游戏。用户输入本金、利率和加分球员,程序将输出利息或比赛赢家。
摘要由CSDN通过智能技术生成

1、下面的程序是当时学习python时想到最近降息,利率变化了写的简单计算本息和的代码,很简单,只为巩固当时学的内容,现在记录在这里供分享和日后查找相关用法

# filename:interest_calculation.py
print '''hello,welcome to use this interest calculation program \n'''
principal = int (raw_input ('please enter your interest (it must be a integer ):') )
print '''then choose how long you will be save the money based on the rate \n '''
print "CURRENT\n the current interest is 0.005 \n "
print "STATED\n the stated interest are as following: \n "
print " 0.031 for three month \n 0.033 for half year \n \
0.035 for one year \n 0.044 for two year \n "

#user input the rate
rate  = float(raw_input ('please enter one of above rate :') )
#or based on the time ,you can use numtime

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值