Chapter 5 Key Terms Flashcards

1
Q

Function

A

A block of code that performs a certain task or set of tasks.

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

Divide and Conquer

A

Breaking down a problem into smaller problems that can be solved. Then combining the solutions to solve the initial problem. Functions can be executed in order.

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

Benefits of Using Functions

A

Benefits include a much simpler code, reusable code, effective testing and debugging, faster development, and easier teamwork when writing codes.

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

Void Functions

A

Executes the statements it contains, then terminates.

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

Value-Returning Functions

A

Executes the statements it contains, and returns a value back to the statement that called it.

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

Function Names

A

Names cannot contain keywords or spaces. The first character has to either be a letter or underscore. Other characters must be a letter, number or underscore. The uppercase and lowercase characters are distinct.

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

Function Definition

A

Determines what that function does.

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

Function Header

A

The first line of the function

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

Block

A

A set of statements that belong together as a group.

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

Function Call

A

A way to execute a specific block of code defined within a function. The interpreter jumps to the function and executes the statement.

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

Indentation and Functions

A

Each block needs to be indented and the lines must start with the same number of spaces.

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

pass

A

Used as a placeholder statement that does nothing when executed.

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

Local Variables

A

Variable that is given a value inside a function.

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

Variable Scope

A

The part of a program where the variable may be accessed.

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

Argument

A

The data that is sent into a function.

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

Parameter

A

The variable that is given the value of an argument when a function is called.

17
Q

Parameter Scope

A

The function in which the parameter is used.

18
Q

Passed by Position

A

The first parameter gets the value of the first argument and the second parameter gets the value of the second argument.

19
Q

Global Variable

A

Created by assignment statement written outside all the functions.

20
Q

Global Constant

A

Global name that references a value that cannot be changed.

21
Q

import Statement

A

Statements that are used to include modules.

22
Q

random

A

Module is a standard library module that provides functions for generating random numbers and performing operations.

23
Q

return Statement

A

Statement used within a function to specify the value that the function should produce as a result when it’s called.

24
Q

None

A

Constant that represents the absence of a value or a null value.

25
Q

math

A

Module that provides a wide range of mathematical functions and constants for performing various mathematical operations.

26
Q

math.pi

A

Represents the mathematical constant π (pi).

27
Q

math.e

A

Represents the mathematical constant e (Euler’s number).

28
Q

Module

A

Files that stores functions of the standard library.