Chapter 7 Key Terms Flashcards

1
Q

Sequence

A

Is an ordered collection of elements that can be of any data type. Ex: strings, tuples, lists.

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

List

A

Is a mutable, ordered collection of elements using square brackets ‘[]’.

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

Mutable

A

Elements can be modified after it is created. Change, add, or remove.

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

Dynamic Data Structure

A

Structure that can change size by changing, adding, or removing elements.

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

Repetition Operator *

A

Is used to repeat a sequence a specified number of times.

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

Index

A

A numerical value that represents the position of an element within a sequence.

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

Starting Index

A

The index of the first element in a sequence.

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

Index of Last Element

A

The last element in a sequence can be found using the formula len(sequence) - 1, where len(sequence) is the length of the sequence.

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

IndexError Exception

A

An exception occurs when you try to access an index that is outside the valid range of indices for a sequence.

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

len

A

Is used to determine the number of elements in a sequence.

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

Concatenating Lists

A

Combining two or more lists into a single list.

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

Slice

A

Extracting a portion of a sequence by specifying a range of indices.

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

in

A

Is used to check if a particular element exists within a sequence.

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

append

A

Is used to add an element to the end of a list.

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

index

A

Is used to find the index of the first occurrence of a specified element in a list.

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

insert

A

Is used to add an element at a specific index within a list.

17
Q

sort

A

Is used to arrange the elements of a list in ascending order.

18
Q

remove

A

Is used to remove the first occurrence of a specified element from a list.

19
Q

reverse

A

Is used to reverse the order of elements in a list.

20
Q

del

A

Is used to remove an element or slice from a list by specifying the index or range of indices.

21
Q

min

A

Is used to find the smallest element in a list.

22
Q

max

A

Is used to find the largest element in a list.

23
Q

Copying a List

A

Creating a new list with the same elements as the original list.

24
Q

Adding Values in a List

A

Involves using methods like append or insert.

25
Q

Averaging Values in a List

A

Summing up the elements in the list and dividing the sum by the number of elements.

26
Q

Passing a List as an Argument

A

A list can be passed as an argument to a function so that the list within it can be operated on or altered.

27
Q

Returning a List from a Function

A

A function can return a list as a result, which allows lists to be created and returned with specific data.

28
Q

List Comprehension

A

Allows you to create a new list by applying an expression to each item in an iterable.

29
Q

Result Expression

A

Defines what will be included in the new list.

30
Q

Iteration Expression

A

Specifies how to iterate over an iterable within a list comprehension.

31
Q

if Clause

A

Is used to filter elements from the source iterable based on a condition.

32
Q

Two-Dimensional List

A

Each element of the outer list is itself a list.

33
Q

Row

A

One of the inner lists or sub lists.

34
Q

Column

A

A specific element at the same index in each of the inner lists.

35
Q

Tuple

A

Is an ordered, immutable collection of elements in Python, defined using parentheses ‘()’.