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