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

货币税和小费浮动并发症

货币税和小费浮动并发症

犯罪嫌疑人X 2021-04-16 17:05:34
我正在制定一个程序,以查找已征税的金额并将其与小费结合在一起。我正在研究小费和介绍。代码:print "Welcome \nEnter The Amount Of Money For the Transaction"amount = raw_inputprint "Taxed Amount Below\n"taxed = (amount * float((1.065)))print taxed这就是我得到的:>>> runfile('/home/meyer/.spyder2/temp.py', wdir='/home/meyer/.spyder2')Welcome Enter The Amount Of Money For the TransactionTaxed Amount BelowTraceback (most recent call last):  File "<stdin>", line 1, in <module>  File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 699, in runfile    execfile(filename, namespace)  File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 81, in execfile    builtins.execfile(filename, *where)  File "/home/meyer/.spyder2/temp.py", line 8, in <module>    taxed = (amount * float((1.065)))TypeError: unsupported operand type(s) for *: 'builtin_function_or_method' and 'float'>>> 我知道我不能乘以这个浮点数,但是我找不到其他方法。甚至MPMath我正在使用python 2.7
查看完整描述

2 回答

?
jeck猫

TA贡献1909条经验 获得超7个赞

您的代码无法正常运行,因为您需要在之后添加参数raw_input,请尝试以下操作:


print "Welcome \nEnter The Amount Of Money For the Transaction"


amount = float(raw_input())


print "Taxed Amount Below\n"

taxed = (amount * float((1.065)))


print taxed


查看完整回答
反对 回复 2021-04-20
  • 2 回答
  • 0 关注
  • 155 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号