Functions Flashcards
1
Q
Declaring a function
A
def functionName(): Indent next line
Ex.
»>def add(a, b):
… return a + b
2
Q
Parameters
A
The variables inside the parenthesis of the signature
Def add(bold, boi)
Bold and boi are the parameters
3
Q
Arguments
A
While parameters are the variables inside the parenthesis,
Arguments are the values actually passed in
4
Q
How to import modules to get more functions?
A
-a module is a set of functions defined somewhere in else
Ex.
»>import
If we did that we’d get all the functions in the module and access to them using the dot-syntax
Ex.
»>Import math
Math.floor(7.8)
5
Q
If we say from import what do we get
A
We get just that function name
Ex.
»>From math import floor
Floor(7.8)