# Computes a hailstone sequence of 'length' steps, # beginning with the given 'start' value, # and prints the max and min integer seen in the sequence. def print_hailstone_max_min(start, length): # initialize max/min and current value min = start max = start print(start, end=" ") # perform the remaining steps of the sequence value = start for i in range(length - 1): if value % 2 == 0: value = value // 2 else: value = 3 * value + 1 print(value, end=" ") if value > max: max = value elif value < min: min = value # display max/min values found print() print("max = ", max) print("min = ", min) def main(): print_hailstone_max_min(7, 12) main()