Home Segments Index Top Previous Next

185: Practice

Write a function that transforms a jockey's weight into one of three integers: if the weight is more than, say, 120, the value returned by the function is to be -1; if the weight is more than 110, the value returned is to be 1; otherwise, the value returned is to be 0. Then, write another function that transforms a race horse's post position into one of three integers: if the post position is 6 or more, the value returned is to be -1; if it is 3 or less, the value returned is to be +1; otherwise, the value returned is to be 0.