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
Averaging Values in a List
Summing up the elements in the list and dividing the sum by the number of elements.
26
Passing a List as an Argument
A list can be passed as an argument to a function so that the list within it can be operated on or altered.
27
Returning a List from a Function
A function can return a list as a result, which allows lists to be created and returned with specific data.
28
List Comprehension
Allows you to create a new list by applying an expression to each item in an iterable.
29
Result Expression
Defines what will be included in the new list.
30
Iteration Expression
Specifies how to iterate over an iterable within a list comprehension.
31
if Clause
Is used to filter elements from the source iterable based on a condition.
32
Two-Dimensional List
Each element of the outer list is itself a list.
33
Row
One of the inner lists or sub lists.
34
Column
A specific element at the same index in each of the inner lists.
35
Tuple
Is an ordered, immutable collection of elements in Python, defined using parentheses '()'.