自己作一個盈餘成長率【g】的計算機
由於太懶惰了,想用現學現賣的python來試著做看看----盈餘成長率【g】的計算機
程式碼:
#盈餘成長率g計算機
stock_id=int(input("請輸入股票代號:"))
roe=float(input("請輸入"+str(stock_id)+"的ROE:"))
eps=float(input("請輸入"+str(stock_id)+"的EPS:"))
dividend=float(input("請輸入"+str(stock_id)+"的股利:"))
cash_interestRate=dividend/eps
#現金配息率=股利/eps
E_growth_rate=roe*(1-cash_interestRate)
#盈餘成長率=roe*(1-現金配息率)=roe*再投資率(RI)
print(str(stock_id)+"現金配息率是"+str(cash_interestRate*100)+"%")
print(str(stock_id)+"的盈餘成長率是"+str(E_growth_rate)+"%")
結果:
>>>
請輸入股票代號:1723
請輸入1723的ROE:39.45
請輸入1723的EPS:9.86
請輸入1723的股利:7.2
1723現金配息率是73.02231237322516%
1723的盈餘成長率是10.642697768762675%
>>>
文章標籤
全站熱搜