Combining Functions (Functions)
Write two functions:
- One called
get_mass_from_length()
that takeslength
(in m),a
andb
as arguments, has the following default argumentsa = 39.9
andb = 2.6
, uses the following code to estimate the mass (in kg)mass <- a * length ^ b
, and returns it. (This function is the answer to the Default Arguments exercise, so feel free to copy over your answer if you’ve done that exercise). - One called
convert_kg_to_pounds
that converts kilograms into pounds (pounds = 2.205 * kg
)
-
Use these two functions (each function should be called separately) to estimate the weight, in pounds, of a 12 m long Stegosaurus with
a = 10.95
andb = 2.64
(The estimateda
andb
values for Stegosauria from Seebacher 2001). -
Use these two functions (each function should be called separately) to estimate the weight, in pounds, of a 4 m long dinosaur using the default parameters.