Home Segments Index Top Previous Next

301: Practice

Write a function that transforms an athlete's pulse rate into one of three integers: if the rate is less than 60, the value returned by the function is to be -1; if the rate is more than 80, the value returned is to be 1; otherwise, the value returned is to be 0. Then, write another function that transforms an athlete's body fat as a percentage of weight into one of three integers: if the athlete's body-fat percentage is less than 10, the value returned is to be -1; if it is more than 20, the value returned is to be +1; otherwise, the value returned is to be 0.