Functions Flashcards

1
Q

Declaring a function

A
def functionName():
     Indent next line 

Ex.
»>def add(a, b):
… return a + b

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Parameters

A

The variables inside the parenthesis of the signature

Def add(bold, boi)

Bold and boi are the parameters

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Arguments

A

While parameters are the variables inside the parenthesis,

Arguments are the values actually passed in

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly