Python 金融入门
Adina Howe
Professor
在代码中存放可引用的信息
msft_stock、interest_rate、bondsinterest_rate = 0.05
变量命名
class、type),应避免使用# 正确
day_2 = 5
# 错误,变量名以数字开头
2_day = 5
$$ \text{市盈率} = \frac{\text{市场价}}{\text{每股收益}} $$
price = 200 earnings = 5pe_ratio = price / earningsprint(pe_ratio)
40
Python 金融入门