6 Functions Flashcards

1
Q

Docstring format

A
def drawsquare(t, sz):
    """Make turtle t and draw square of size sz"""
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Runtime-retrievable documentation

A

Docstring

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

Function Call other name

A

Function Invocation

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

Function Invocation other name

A

Function Call

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

Functions that return are called

A

Fruitful

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

Default return of functions

A

None

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

“Same thing” as far as unit test parameters are concerned

A

Equivalence Class

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

Local and global variables of same name

A

Shadowing

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

Parameters vs Arguments

A

Arguments are actual parameters/things given

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

How say __main__

A

Dunder main

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

How to invoke main() selectively

A

if __name__ == “__main__”:

main()

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

Rounding

A

round(1.001) == 1 ==> True

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

Pytest format

A
def test_3_to_the_2():
    assert 9 == math.exponent(3, 2)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Functional decomposition

A

Breaking big problems into smaller ones

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

Breaking big problems into smaller ones

A

Functional Decomposition

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

Flow of Execution

A

Order statements are executed

17
Q

Order statements are executed

A

Flow of Execution

18
Q

Doing and testing small bits at a time

A

Incremental Development

19
Q

Incremental Development

A

Doing and testing small bits at a time

20
Q

Building functions using other functions

A

Composition

21
Q

Composition

A

Building functions using other functions