掃二維碼與項(xiàng)目經(jīng)理溝通
我們?cè)谖⑿派?4小時(shí)期待你的聲音
解答本文疑問/技術(shù)咨詢/運(yùn)營(yíng)咨詢/技術(shù)建議/互聯(lián)網(wǎng)交流
創(chuàng)新互聯(lián)Python教程:

在這個(gè)簡(jiǎn)單的 python 程序中,我們需要找到簡(jiǎn)單的興趣。這是一個(gè)中級(jí) python 程序。
要理解這個(gè)例子,您應(yīng)該了解以下 Python 編程主題:
在這個(gè)求解好的 python 程序中,我們需要計(jì)算 Simple Interest,可以用公式 SI = pnr / 100 來計(jì)算。在哪里
例如,假設(shè)我們以 10%的利率貸款 1000 英鎊,期限為 1 年。然后通過公式 pnr/100 計(jì)算單利得出 1000 10 1 / 100 = 100。所以我們要給 100 盧比作為 1 年的利息。
現(xiàn)在在 python 編程語言中應(yīng)用這個(gè)邏輯。我們使用 python 語言中的input函數(shù)接受本金、利率和時(shí)間的值。然后我們用公式 ( p n r ) / 100 計(jì)算利息。
STEP 1: 使用 python 語言的輸入函數(shù)接受本金金額、時(shí)間和利率的值。使用浮點(diǎn)和 int 數(shù)據(jù)類型將值轉(zhuǎn)換為整數(shù)。
第二步:用公式 (pnr) / 100 計(jì)算單利。
STEP 3: 使用 python 編程語言中的 print 語句打印簡(jiǎn)單興趣的值。
principle=float(input("Enter the amount :"))
time=int(input("Enter the years :"))
rate=float(input("Enter the rate :"))
si=(principle*time*rate)/100
print("The simple interest is:", si)
Enter the amount : 1000
Enter the year : 1
Enter the rate : 10
The simple interest is : 100 
我們?cè)谖⑿派?4小時(shí)期待你的聲音
解答本文疑問/技術(shù)咨詢/運(yùn)營(yíng)咨詢/技術(shù)建議/互聯(lián)網(wǎng)交流