股票计算小程序
定义以下变量:
-name,公司名
-stock_price,当前股价
-stock_code,股票代码
-stock_price_daily_growth_facter,股票每日增长系数,浮点数类型
-growth_days,增长天数 计算,经过growth_days天的增长后,股价达到了多少 使用字符串格式化进行输出,如果是浮点型,要求小数点精度2位数
name="美团"
stock_code=12334
stock_price=19.99
stock_price_daily_growth_facter=1.2
growth_days=7
growth_price= stock_price+stock_price* stock_price_daily_growth_facter** growth_days
print(f"公司名:{name},股票代码:{stock_code},当前股价:{stock_price}")
print("每日增长系数:%.1f,经过%d天增长后,股价达到了:%.2f"%(stock_price_daily_growth_facter,growth_days,growth_price))
运行结果

2012

被折叠的 条评论
为什么被折叠?



