为了账号安全,请及时绑定邮箱和手机立即绑定

如何在这句话中添加一个整数?

如何在这句话中添加一个整数?

倚天杖 2023-12-12 20:29:33
我试图让 python 运行一个看起来像这样的语句。"How much did you make this year: " #Enter amount here in cash"Expect to pay (4% of your amount in cash) in taxes this year."
查看完整描述

2 回答

?
MMTTMM

TA贡献1869条经验 获得超4个赞

您可以使用以下代码:

pay = int(input("How much did you make this year:"))
print(f"Expect to pay {pay * 0.04} in taxes this year.")


查看完整回答
反对 回复 2023-12-12
?
MMMHUHU

TA贡献1834条经验 获得超8个赞

val = input("你今年赚了多少钱:")

print("今年预计缴纳 "+str(0.04*float(val))+ " 税款。")


查看完整回答
反对 回复 2023-12-12
  • 2 回答
  • 0 关注
  • 55 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信