2024-04-20 04:00:03 发布
网友
我很难舍入数字。我试着把它包括在我最初的描述中,即monthlyInterestrate = round(annualInterestrate/12.0, 2)
monthlyInterestrate = round(annualInterestrate/12.0, 2)
打印时也有几种格式,例如:
print ('Minimum monthly payment: ' + str(round monthlyPayment),2)
我的表述有误吗?你知道吗
任何洞察都将不胜感激!你知道吗
这不管用吗?你知道吗
monthlyPayment = 10.126234 print ('Minimum monthly payment: ' + str(round(monthlyPayment, 2)))
print "%0.2f"%monthlyPayment #or print "{0:0.2f}".format(3.45678)
如果你只是想在打印的时候把它四舍五入的话应该可以,尽管我应该提到它并不总是四舍五入的,例如3.3447 -> 3.34但是3.345 -> 3.35
3.3447 -> 3.34
3.345 -> 3.35
这不管用吗?你知道吗
如果你只是想在打印的时候把它四舍五入的话应该可以,尽管我应该提到它并不总是四舍五入的,例如
3.3447 -> 3.34
但是3.345 -> 3.35
相关问题 更多 >
编程相关推荐