If Statements In Functions (Making Choices)
1. Write a function named double_if_small that
- Takes a number as input
- If the input is less than 26, returns the number multiplied by 2
- If the input is greater than or equal to 26, returns just the original number (not multiplied by two).
Call the function with 10 as the input.
2. Call the function from (1) with 30 as the input.
3. Write a function called prediction that takes a single argument x. If x is both greater than 0 and less than 15 then return y = 6 + 0.8 * x. If x is both greater than 15 and less than 30 then return y = 5 + 0.75 * x. In all other cases return y = NA. Call the function with 5 as the input.
4. Call the function from (3) with 26 as the input.
5. Call the function from (3) with -2 as the input.