Default Arguments (Functions)
This is a follow up to Use and Modify.
Allowing a
and b
to be passed as arguments to get_mass_from_length()
made the function more flexible, but for some types of dinosaurs we don’t have specific values of a
and b
and so we have to use general values that can be applied to a number of different species.
Rewrite your get_mass_from length()
function from Use and Modify so that its arguments have default values of a = 39.9
and b = 2.6
(the average values from Seebacher 2001).
- Use this function to estimate the mass of a Sauropoda (
a = 214.44
,b = 1.46
) that is 22 m long (by settinga
andb
when calling the function). - Use this function to estimate the mass of a dinosaur from an unknown taxonomic group that is 16m long.
Only pass the function
length
, nota
andb
, so that the default values are used.