Exercise

General binge drinking function

Let's put together everything you've done so far. You have two binge status functions - one for males and the other for females. In this exercise you will write a function that accepts two arguments: sex and num_drinks. You will make use of the functions binge_male() and binge_female() you defined in the previous exercise.

Similar to R, parameters in the function definition are separated by a comma.

Instructions 1/2

undefined XP
    1
    2
  • Write a binge_status() function that takes 2 arguments: sex and num_drinks.
  • Using binge_male() and binge_female() functions, return the correct num_drinks for the relevant sex.