# encoding=utf-8 def zhaoqian(money): loop=true tmp=['总金额:'+str(money)+'元'] # 面值列表 单位:元 cate=( 100, 50, 20, 10, 5, 1, 0.5, 0.1 ) sy=int(money*10) while loop: if sy==0: loop=false else: for row in cate: tmpstr = '' jine=int(row*10) if jine>=10: tmpun = '元' else: tmpun = '角' if sy>=jine and tmpstr=='': m = sy//jine sy = sy%jine if jine>=10: tmpstr = str(jine//10)+tmpun+str(m)+'张' else: tmpstr = str(jine)+tmpun+str(m)+'张' tmp.append(tmpstr) return tmp a=zhaoqian(88.7)for x in a: print x
