Calculating compound interest.,,principal =
Calculating compound interest.,,principal =
principal = 1000.0 # starting principalrate = .05 # interest rateprint 'Year %21s' % 'Amount on deposit'for year in range( 1, 11 ): amount = principal * ( 1.0 + rate ) ** year print '%4d%21.2f' % ( year, amount )
相关内容
- Dictionaries are indexed by keys, which can be any immutable type,i
- Random float,randomfloat,import rando
- Change Dir,changedir,import osos.
- Get element by name,getelementbyname,from xml.dom
- Rectangle Border width,rectangleborder,from Tkinter
- Sorting Keys: for Loops,sortingloops,D = {'a': 1,
- Use file pointer to get file content,usepointer,f = open('so
- List files in the zip file,listzip,import zipfi
- String method: With a minor replacement,minorreplacement,quote = 'P
- Default parameter values,parametervalues,# positional
评论关闭