【发布时间】:2022-06-11 00:19:29
【问题描述】:
我还是 Python 新手,如果这是一个荒谬的问题,那么抱歉。我正在尝试将此模块作为“速率”导入,但标题中不断出现错误。任何 cmets 都会有所帮助。
def pay(r, h):
total = r * h
return total
def over(ra, hs):
over_time = ra * 40 + (ra * 1.5 * ( hs - 40))
print(f'{over_time} is')
这是主要代码:
import rate
def main():
calc()
calc()
calc()
def calc():
name = input('Enter employee name: ')
rates = int(input(f'Enter hourly rate for {name}: '))
hours = int(input(f'Enter hours for {name} this week: '))
if rates <= 40:
p = rate.pay(rate, hours)
print(f'Pay for {name} is ${p:,.2f}')
else:
rate.over(rate, hours)
if __name__ == '__main__':
main()
【问题讨论】:
-
rate.pay(rates, hours)和rate.over(rates, hours),你忘记了一封信s。
标签: python function module typeerror operands