Files
python/练习与案例/股价计算小程序.py
T
2025-08-05 09:19:34 +08:00

12 lines
675 B
Python

name = "大壮农场"
stock_price = 221
stock_code = 115899
stock_price_daily_growth_factor = 1.2
growth_days = 15
# 计算经过growth_days天的增长后,股价达到了多少钱?
# message = f"我们公司叫做{name},股票代码为{stock_code},当前股票价格为{stock_price}元," \
# "经过{growth_days}天后,公司股价达到了{stock_price * (stock_price_daily_growth_factor ** growth_days)}元"
# print(message)
print(f'我们公司叫做{name},股票代码为{stock_code},当前股票价格为{stock_price}元,')
print('经过%d天后,公司股价达到%.2f'% (growth_days,stock_price * (stock_price_daily_growth_factor ** growth_days)))