Rewrite the Python code and:
-Call all the functions in " main" function.
-Use try/except (or other checking inputs designs) inside the get_input function to check the user inputs.
-Check your code for any invalid inputs: string inputs and also negative numbers
def get_input():
n = int(input("Enter Hours: "))
rate = float(input("Enter Rate: "))
return n, rate
def compute_pay(hours, rate):
if hours <= 40:
return hours * rate
else:
return (40 * rate) + ((hours - 40) * rate * 1.5)
def print_output(payment):
print("Pay: " + str(payment))
def main():
the_hours, the_rate = get_input()
the_pay = compute_pay(the_hours, the_rate)
print_output(the_pay)
main()If you have any doubts, please give me comment....
def get_input():
while True:
try:
n = int(input("Enter Hours: "))
if n<0:
print("Hours can't be negative! Reenter: ")
else:
break
except ValueError:
print("Hours must be integer")
while True:
try:
rate = float(input("Enter Rate: "))
if(rate<0):
print("Rate must be positive")
else:
break
except ValueError:
print("rate must be integer!")
return n, rate
def compute_pay(hours, rate):
if hours <= 40:
return hours * rate
else:
return (40 * rate) + ((hours - 40) * rate * 1.5)
def print_output(payment):
print("Pay: " + str(payment))
def main():
the_hours, the_rate = get_input()
the_pay = compute_pay(the_hours, the_rate)
print_output(the_pay)
main()

Rewrite the Python code and: -Call all the functions in " main" function. -Use try/except (or...