Original
def main():
hours = float(input("enter hours: "))
rate = float(input("enter rate: "))
if hours <= 40:
pay - hours * rate;
else:
pay = 40 * rate + (hours - 40) * (rate * 1.5);
print(pay)
main()
With Function
def pay(hours, rate):
if hours <= 40:
return hours * rate;
else:
return 40 * rate + (hours - 40) * (rate * 1.5);
def main():
hours = float(input("enter hours: "))
rate = float(input("enter rate: "))
print(pay(hours, rate))
main()
No comments:
Post a Comment