New User Help

Luzerjunkie luzerjunkie at aol.com
Fri May 11 18:17:15 CEST 2001


I am trying to write a simple payroll program.  I just started learning python
today so go real easy on me.  Here is the whole program:

#This is the amount each person makes per hour...j is salaried.

j = 375
c = 5.75
a = 5.25
b = 5.15

#The next 4 lines should acquire the amount of hours each makes

jhours = input("How many hours did Jody work?")
chours = input("How many hours did Cathy work?")
ahours = input("How many hours did Anthony work?")
bhours = input("How many hours did Bryan work?")

#These two should tally the total hours for the week and display them

hours = jhours+chours+ahours+bhours
print ("Total hours are "), hours

#This should figure the amount each makes from the above hourly pay with the
#number hours input previously

cmoney = chours*c
print ("Cathy made "),cmoney
amoney = ahours*a
print ("Anthony made "), amoney
bmoney = bhours*b
print ("Bryan made "), bmoney

#This adds up the total payroll for the week and displays it

money = cmoney+amoney+bmoney+j
print ("Total payroll is "), money

#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

any help would be appreciated.

Luzer



More information about the Python-list mailing list