RU beehive logo ITEC dept promo banner
ITEC 109
2014spring
ibarland

homeinfolectslabsexamshws
D2Lbreeze (snow day)tutor/PIs

lab03-function-terminology
Calling a function
doubles; 'argument', 'return type'

Review quiz (10min).


calling functions

Recall the examples we tried:

The last example — the square root of two — illustrates one more type of data that python has: “floating point numbers”, which is a number with a decimal-point1. They commonly called “float”s or “double”s2.

Updated list: In Python, we have several types of values:

Calling a function is like asking a question. Well, it's lika person who only answers one very specific question, if you give them an input: You walk up to (say) len, give them the information (e.g. “"Mississippi"”), and they'll give you an answer: 11.
We say that len is the function name, "Mississippi" is the argument we give it, and 11 is the result. Since the result is always an int, we say: “len's return-type is int.”.
Give examples for some other functions we've seen:

Can you name a function we've seen, that requires two arguments?


Day 4: I demo'd the functions below, and mentioned arguments and return-types; we haven't tried it ourselves, nor discussed function-composition.


1 It turns out, inside the computer the decimal-point can “float around”, hence the name.      

2 “double” is short for “double-precision floating-point”. But these days, single-precision floating-points are hardly ever used, which is why “double” has become a synonym for floating-point numbers.      

homeinfolectslabsexamshws
D2Lbreeze (snow day)tutor/PIs


©2013, Ian Barland, Radford University
Last modified 2014.Jan.27 (Mon)
Please mail any suggestions
(incl. typos, broken links)
to ibarlandradford.edu
Powered by PLT Scheme