Unit 10 Flashcards

1
Q

10.2 - Functions are Objects

What is bytecode?

A

a low-level operation performed by the interpreter

kinda like mental math

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

10.3 - Scope of Variables and Functions

What is scope?

A

a domain where variables/functions are only visible to part of a program

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

10.3 - Scope of Variables and Functions

What is a local variable?

A

a variable located within an inner scope

ex. within functions, loops, etc.

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

10.3 - Scope of Variables and Functions

What are global variables?

A

variables within a scope that extends outside the local

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

10.3 - Scope of Variables and Functions

Why are global variables frowned upon?

A

encourages lazy programming; functions may change variables

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

10.4 - Namespaces & Scope Resolution

What is a namespace?

A

a component that maps names to objects

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

10.4 - Namespaces & Scope Resolution

What is scope resolution?

A

the process of searching for a name in the available namespace

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

10.5 - Keyword Arguments & Default Parameter Values

What are keyword arguments?

A

maps values to parameters based on name

ex. split_check(125.00, tip_percentage=0.15, num_people=2, tax_percentage=0.095)

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

10.5 - Keyword Arguments & Default Parameter Values

What are default parameter values?

A

placeholder values for function arguments

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

10.6 - Arbitrary Argument Lists

What is an arbitrary argument list?

A

a tuple that allows for additional parameters in a function

uses *args

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

10.6 - Arbitrary Argument Lists

What are keyword arguments?

A

a dictionary for extra arguments

uses **kwargs

like an AAL

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

10.7 - Multiple Function Outputs

What is packing and unpacking?

A

returning several outputs using a container; a statement performs several assignments to accomodate for the outputs

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

10.8 - Using Docstrings to Document Functions

What is a docstring?

A

using ''' or """ to denote a comment

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

10.8 - Using Docstrings to Document Functions

What does help() do?

A

provides documentation associated with an object

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

10.10 - Function Arguments

What is a pass-by-assignmnent?

A

arguments in functions are passed by object reference

global -> object -> local

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