# freelance_biller.py
# This program accepts a start time and an end time and calculates
# the total bill for freelance work completed.
# by Scott Gordon
def main():
print("***** Welcome to Freelance Biller *****\n")
start_time = input("Enter the billing start time in 00:00 24hr format: ")
finish_time = input("Enter the billing end time in 00:00 24hr format: ")
pay_rate = float(input("Enter the rate of pay in 00.00 usd format: "))
def freelance_biller(stime, ftime, rate):
"""Accepts a start time, end time and payrate, then calculates the
bill accordngly"""
stime_split = stime.split(":")
ftime_split = ftime.split(":")
hours_diff = int(ftime_split[0]) - int(stime_split[0])
mins_dif = int(ftime_split[1]) - int(stime_split[1])
hours_bill = rate * hours_diff
mins_bill = rate * (mins_dif / 60)
bill = hours_bill + mins_bill
return f"\nClients bill is: ${bill:.2f}"
print(freelance_biller(start_time, finish_time, pay_rate))
if __name__ == '__main__':
main()
Photo by Joseph Frank on Unsplash
Top comments (0)