Allen B. Downey's "How to Think Like a Computer Scientist"
Read sections 3.3 to 3.10 on pages 23-30, which outline how to use and create functions. Functions are small segments of code that are removed from the normal code flow, and they are called to perform specific actions. After the function executes, control returns back to the normal flow. Within a function, data may be sent and returned to the rest of the program.
Click http://web.archive.org/web/20161012213457/http://www.greenteapress.com/thinkcpp/thinkCScpp.pdf link to open resource.