Search code examples
pythonpython-2.7currencyraw-input

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!


Solution

  • Your code did not work because you need parameters after raw_input, try the below:

    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