New User Help

Costas Menico costas at meezon.com
Fri May 11 15:33:01 EDT 2001


luzerjunkie at aol.com (Luzerjunkie) wrote:
<snip>
>
>#Here is where I run into a problem, I need to figure the payroll percent which
>is #done by dividing the expected gross amount for the week and dividing it by
>the #total amount ofpayroll.  The next 8 lines is the error I get when trying
>to calculate #it. Traceback (most recent call last):File
>#$"c:\python21\pythonwin\pywin\framework\scriptutils.py", line 301, in
>#RunScript#    exec codeObject in __main__.__dict__#  File "C:\Documents #and
>Settings\Jody1\My Documents\Script1.py", line 25, in ?#    payrollpercent #=
>gross/money#TypeError: unsupported operand type(s) for /
>
>gross = int(input("How much is the weekly expected gross?"))
>payrollpercent = gross/money
>
>#This should display the payroll percent.
>
>print ("Payroll percent is "), payrollpercent

The above code worked for me. Try putting the following print
statments before the 'payrollpercent = gross/money' calculation:

print type(gross)
print type(money)

To verify that the datatype is numeric. You should get a float or int
Anything else could be a problem.

 I also hope you are not typing in a comma in the numbers or any non
numeric character like $. This will result in a tupple

Costas




More information about the Python-list mailing list