Lecture 4 Flashcards

1
Q

Data structure

A

Is a specific way of organizing storing and managing data in a computer so that it can be efficiently accessed and modified they help solve complex problems and enable faster algorithms by aligning the data organization with a task at hand

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

List

A

A list is a built in data structure in python used to store an ordered collection of items. Lists are mutable meaning their contents can be changed after creation items and lists can be different data types.

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

Mutable

A

Elements can be modified, added or removed after list is created

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

Can if statements be empty

A

No they must have something to execute it True

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

pass

A

Pass command keeps the program moving forward but does not execute any commands

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

List

A

Stores an ordered collection (possibly duplicate) items. They are mutable and can be different data types

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

Mutable

A

Can be changed after creation

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

Index

A

The specific location of an element in a list. Starts at 0, is referenced using []

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

Append

A

Add elements to the end of the list using list.append()

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

Insert element into list at a specific index

A

List. Insert(idx, )

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

Remove and return last element in a list

A

List.pop()

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

Remove and return element at specified index

A

List.pop(idx)

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

Reverse order of list

A

List.reverse()

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

Sprt in ascending order

A

list.sort()

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

Find length of list

17
Q

Check if element is in a list

A

Is ‘ ‘ in list

18
Q

Negative indicies in python lists

A

Count backwards