Module 6 Flashcards

1
Q

what are local variables ?

A

Local variables are any objects that have been created within a function and only exist inside the function where they are made.

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

What is a local environment ?

A

Code within a function is described as a local environment.

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

purpose of local variables

A

they cannot be accessed from anywhere outside the function

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

global variable

A

variables created outside any function

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

List the 4 main sections of a numpy format docstring

A

The NumPy format includes 4 main sections:
- A brief description of the function
- Explaining the input Parameters
- What the function Returns
- Examples

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

how to read the docstring for the len function ?

A

?len

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

What happens when you implement defensive programming ?

A

Code written in such a way that if errors do occur, they are handled in a graceful, fast and informative manner.

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

What do you mean by raising an exception ?

A

we are forcing our own error with our own message.

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

Name some types of exception

A

valueError and typeError

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