-1

I would like to get rid of None but I don't know what is my mistake here...

def job(hours,rate):
       if hours < 40:
           sm = hours * rate
           print(sm)
       elif hours > 40:
           sm = 40 * rate
           ov = ((hours - 40) * rate) * 0.5
           tt = sm + ov
           print(tt)
       
a = float(input())
b = float(input())

print(job(a,b))
print("Fine") 
Konrad Rudolph
  • 530,221
  • 131
  • 937
  • 1,214

1 Answers1

2

This happens as you are printing a function that does not return anything. Just call the function, do not print it, as without the return statement, a function returns None by default, you can update the function to add a return statement :

def job(hours,rate):
       if hours < 40:
           sm = hours * rate
           return sm
       elif hours > 40:
           sm = 40 * rate
           ov = ((hours - 40) * rate) * 0.5
           tt = sm + ov
           return tt
       
a = float(input())
b = float(input())

print(job(a,b))
print("Fine")
Roshin Raphel
  • 2,612
  • 4
  • 22
  • 40