- Joined
- Sep 25, 2009
- Messages
- 1
- Reaction score
- 0
my teacher gave us an excersice to do for python. it looks like this
empnamelist=["bobby brown","jimmy john","ronald mcdonald","burger king","papa johns"]
def empnamecheck():
pointer=0
while pointer<=len(empnamelist()):
while match !=false:
if name==emmnamelist[pointer]:
match=true
pointer=pointer+1
def hours():
hours=input('how many hours did you work?:')
return hours
def payrate():
payrate=input('how much is the payrate?:')
return payrate
def calchours(pr,h):
if h>40:
rh=40
oh=h-40
else:
rh=h
oh=0
print 'pay rate $%o.2f' % pr
print 'regular hours %d' % rh
print 'overtime hours %d' % oh
print 'regular pay $%0.2f' % (rh*pr)
print 'overtime pay $%0.2f' % (oh*pr*1.5)
print 'total pay $%0.2f' % (rh*pr+oh*pr*1.5)
def main():
name=raw_input('enter the employees name as firstname lastname:')
empnamecheck()
hrs=hours()
pyr=payrate()
calchours (pyr,hrs)
main()
and im getting this error
Traceback (most recent call last):
File "C:/Users/Johnny/Desktop/payroll.py", line 41, in <module>
main()
File "C:/Users/Johnny/Desktop/payroll.py", line 35, in main
empnamecheck()
File "C:/Users/Johnny/Desktop/payroll.py", line 4, in empnamecheck
while pointer<=len(empnamelist()):
TypeError: 'list' object is not callable
what am i doing wrong? :/
empnamelist=["bobby brown","jimmy john","ronald mcdonald","burger king","papa johns"]
def empnamecheck():
pointer=0
while pointer<=len(empnamelist()):
while match !=false:
if name==emmnamelist[pointer]:
match=true
pointer=pointer+1
def hours():
hours=input('how many hours did you work?:')
return hours
def payrate():
payrate=input('how much is the payrate?:')
return payrate
def calchours(pr,h):
if h>40:
rh=40
oh=h-40
else:
rh=h
oh=0
print 'pay rate $%o.2f' % pr
print 'regular hours %d' % rh
print 'overtime hours %d' % oh
print 'regular pay $%0.2f' % (rh*pr)
print 'overtime pay $%0.2f' % (oh*pr*1.5)
print 'total pay $%0.2f' % (rh*pr+oh*pr*1.5)
def main():
name=raw_input('enter the employees name as firstname lastname:')
empnamecheck()
hrs=hours()
pyr=payrate()
calchours (pyr,hrs)
main()
and im getting this error
Traceback (most recent call last):
File "C:/Users/Johnny/Desktop/payroll.py", line 41, in <module>
main()
File "C:/Users/Johnny/Desktop/payroll.py", line 35, in main
empnamecheck()
File "C:/Users/Johnny/Desktop/payroll.py", line 4, in empnamecheck
while pointer<=len(empnamelist()):
TypeError: 'list' object is not callable
what am i doing wrong? :/