Abstract
This chapter introduces two fundamental programming concepts: functions and branching. We are used to functions from mathematics, where we typically define a function f(x) as some mathematical expression of x, and then we can then evaluate the function for different values of x, plot the curve y = f(x), solve equations of the kind f(x) = 0, and so on. A similar function concept exists in programming, where a function is a piece of code that takes one or more variables as input, carries out some operations using these variables, and produces output in return.
Chapter PDF
Author information
Authors and Affiliations
Corresponding author
Rights and permissions
Open Access This chapter is licensed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/), which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license and indicate if changes were made.
The images or other third party material in this chapter are included in the chapter's Creative Commons license, unless indicated otherwise in a credit line to the material. If material is not included in the chapter's Creative Commons license and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder.
Copyright information
© 2020 The Author(s)
About this chapter
Cite this chapter
Sundnes, J. (2020). Functions and Branching. In: Introduction to Scientific Programming with Python. Simula SpringerBriefs on Computing, vol 6. Springer, Cham. https://doi.org/10.1007/978-3-030-50356-7_4
Download citation
DOI: https://doi.org/10.1007/978-3-030-50356-7_4
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-50355-0
Online ISBN: 978-3-030-50356-7
eBook Packages: Mathematics and StatisticsMathematics and Statistics (R0)