hours= int(input('hours: '))
rate= int(input('rate: '))
if hours>40:
extrahours= hours-40
pay= (1.5rateextrahours)+ (hours*rate)
print(pay)
hi, I am getting wrong answer with the above code, can somebody sort out the problem. I am getting correct answer only if I define hours=40 in loop. Why do we need it to be defined in loop if we are taking it as an input previously.
Hi, Navjot.
We are here making hours =10, to maintains it’s value as 40.
So, that to maintain the hours value as 40 here hours=40 as the original value. As the threshold no. of hours is =40 hours only and rate applied is “rate” i:e 10% , those who are beyond that we need to charge
All the best