All gists matching topic return-on-investment

timmy / 投資報酬率 (ROI) 計算

0 polubień
0 forków
1 plików
Ostatnio aktywne 10 months ago
這個 Python 函數計算投資報酬率 (ROI),衡量投資的盈利能力。ROI 公式為 (投資收益 - 投資成本) / 投資成本 * 100,用於評估投資回報的效率,適用於個人理財、企業投資和專案決策。
1 def calculate_roi(investment_cost, investment_gain):
2 """
3 計算投資報酬率 (ROI) 的函數。
4
5 :param investment_cost: 投資成本
6 :param investment_gain: 投資收益
7 :return: 投資報酬率 (ROI)
8 """
9 net_profit = investment_gain - investment_cost
10 roi = (net_profit / investment_cost) * 100
Nowsze Starsze