# to use the min method from math import * def hours(num): # casting input from string to int days = int(raw_input("Employee " + str(num) + ": How many days? ")) hours = 0 for i in range(days): # capping at 8 hours hours += min(8, int(raw_input("Hours? "))) # casting int to float for precision average = float(hours)/days print "Employee " + str(num) + "'s total hours = " + str(hours) + " (%4.2f / day)" % (average) print return hours print "Total hours for both = " + str(hours(1) + hours(2))