货币税和小费浮动并发症

我正在制定一个程序,以查找已征税的金额并将其与小费结合在一起。


我正在研究小费和介绍。


代码:


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


amount = raw_input


print "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 Transaction

Taxed Amount Below


Traceback (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


犯罪嫌疑人X
浏览 156回答 2
2回答

jeck猫

您的代码无法正常运行,因为您需要在之后添加参数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
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python