Functions

Nested Functions


This is a follow up to Writing Functions.

Measuring things using the metric system is great for us scientists, but when you call your grandmother this weekend (you do call your grandmother every weekend don’t you?) you’d like to tell her that you’re taking this awesome class where you learned how to program a computer to calculate how much dinosaurs weigh (if you phrase it like this she’ll have something really cool to brag about to her friends), and that you calculated the weight of a Stegosaurus (no need to scare grandma by talking about the totally awesome, and really scary, Spinosaurus). The problem is that your grandmother doesn’t really know what a kilogram is, she wants to know what it weighed in pounds. So, hook your grandmother up and write a function that converts kilograms into pounds (there are 2.205 pounds in a kilogram). Use that function along with your dinosaur mass function to estimate the weight, in pounds, of a 12 m long Stegosaurus (12 m is about as big as they come and we want grandma’s story to be as wild as possible). In Stegosauria, a has been estimated as 10.95 and b has been estimated as 2.64 (Seebacher 2001).

[click here for output]