Week 5 Ch 6 Flashcards

1
Q

What does return do?

A

Returns from function and uses following expression as the value

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

When a return statement is executed what happens?

A

Function terminates

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

Code after a return statement is called what?

A

Dead code

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

What is composition when referring to functions?

A

Calling one function from within another function

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

What is a guardian?

A

Programming pattern that uses a conditional statement to check for and handle situations that could cause errors

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

Explain this for loop.

For a in range (1,3):
Print(a)

A

A range of numbers is made 1,2,3 then for each item a variable is assigned to it. During the for loop, print will print the value of a for each time it parses through the range. It ends before it reaches 3 and doesn’t print that because that’s how Python works.

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

Do fruitful functions have a return value of None?

A

No they do not

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