Being able to see functions as Contracts, Examples or Definitions is like having three powerful tools. These representations can be used together to solve word problems!
1 When reading a word problem, the first step is to figure out the Contract for the function you want to build. Remember, a Contract must include the Name, Domain and Range for the function!
2 Then we write a Purpose Statement, which is a short note that tells us what the function should do. Professional programmers work hard to write good purpose statements, so that other people can understand the code they wrote!
3 Next, we write at least two Examples. These are lines of code that show what the function should do for a specific input. Once we see examples of at least two inputs, we can find a pattern and see which parts are changing and which parts aren’t.
4 To finish the Examples, we circle the parts that are changing, and label them with a short variable name that explains what they do.
5 Finally, we define the function itself! This is pretty easy after you have some examples to work from: we copy everything that didn’t change, and replace the changeable stuff with the variable name!
These materials were developed partly through support of the National Science Foundation, (awards 1042210, 1535276, 1648684, and 1738598). Bootstrap by the Bootstrap Community is licensed under a Creative Commons 4.0 Unported License. This license does not grant permission to run training or professional development. Offering training or professional development with materials substantially derived from Bootstrap must be approved in writing by a Bootstrap Director. Permissions beyond the scope of this license, such as to run training, may be available by contacting contact@BootstrapWorld.org.