python - Money Tax and Tip Float Complication
问题描述
I am making a program to find the taxed amount of money and combine that with the tip.
I am working on the tipped amount and intro.
Code:
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
And this is what I get out:
>>> 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'
>>>
I know that I cant multiply by this float, but I cant find any other way. Even MPMath
I am using python 2.7
Thanks In Advance!
解决方案
您正在尝试将内置函数乘以浮点数。您必须改为调用该函数来获取一个数字:
amount = float(raw_input())
推荐阅读
- javascript - VueDraggable 在拖放时向数据库发送请求
- docker - 将 docker 暴露于互联网“无法完成隧道连接”
- python - Django REST 框架 - 使用日期外部 Views.py 文件过滤查询参数
- vue.js - 如何从 nuxt 中的 vueRouter 访问 vuex 状态
- flutter - 如何摆脱颤振中的无效双重错误
- reactjs - 如何正确 setState 和 useEffect 从 React(钩子)中的对象读取和显示值?
- c# - 如何使用多线程优化大文件中单词和字符的计数?
- firebase-authentication - Firebase 身份验证:使用谷歌选项登录是否有任何限制
- amp-html - 怎么会出现粘性adsense?
- c - 在 C 中为整数分配双精度会导致程序崩溃