货币税和小费浮动并发症

时间:2018-06-30 02:36:18

标签: python python-2.7 currency raw-input

我正在制作一个程序,以查找应纳税的金额并将其与小费结合起来。

我正在研究提示的金额和简介。

代码:

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

预先感谢!

2 个答案:

答案 0 :(得分:1)

您正在尝试将内置函数乘以浮点数。您必须改为调用该函数以获得一个数字:

<section id="main">
  <div class="gallery">
    <div><img src="https://unsplash.it/600/400?image=580"></div>
    <div><img src="https://unsplash.it/500/340?image=870"></div>
    <div><img src="https://unsplash.it/520/400?image=767"></div>
    <div><img src="https://unsplash.it/650/400?image=296"></div>
    <div><img src="https://unsplash.it/620/410?image=168"></div>
    <div><img src="https://unsplash.it/600/450?image=871"></div>
    <div><img src="https://unsplash.it/355/400?image=826"></div>
    <div><img src="https://unsplash.it/620/410?image=168"></div>
    <div><img src="https://unsplash.it/600/450?image=871"></div>
    <div><img src="https://unsplash.it/355/400?image=826"></div>
  </div>
</section>

答案 1 :(得分:0)

您的代码无效,因为您需要在/home之后输入参数,请尝试以下操作:

raw_input