2017-02-20 9 views
0

私はちょっと大嫌いだと知っていますが、私は小数点第2位まで四捨五入されたこの単純なコード(コンピューティングプロジェクトの一部)を手に入れようとしています。そうすることができました。基本ローン計算機

loan = float(input("Please enter Amount that you would like to borrow (£):")) 
loanduration = float(input("Please enter Duration of the loan(Months):")) 


print("You will pay (£)" ,loan/loanduration, "per month") 



It outputs like so 
Please enter Amount that you would like to borrow (£):4000 
Please enter Duration of the loan(Months):12 
You will pay (£) 333.3333333333333 per month 
>>> 

答えて

0
loan = float(input("Please enter Amount that you would like to borrow (£): ")) 
loanduration = float(input("Please enter Duration of the loan(Months): ")) 
print("You will pay (£) %.2f per month" % (loan/loanduration)) 

使用例:

Please enter Amount that you would like to borrow (£): 4000 
Please enter Duration of the loan(Months): 12 
You will pay (£) 333.33 per month 

それは深夜だったと私は完全にそれについて忘れてしまったようhere!

+1

はこれで私を助けてくれてありがとう、それを試してみてください –

関連する問題