vendredi 11 septembre 2020

Using if else statement inside a function [closed]

I should write my pay computation with time and a half for over 40 hours and to create a function called computepay which takes two parameters(hours and rate). But python seems to ignore my if else statement

def computepay(hours, rate):
    pay = hours * rate
    if hours>40:
        print(pay)
    else:
        print(pay * 1.5)

hours = int(input("Enter hours: "))
rate = int(input("Enter rate:"))

computepay(hours, rate)

Aucun commentaire:

Enregistrer un commentaire