Review Flashcards

(42 cards)

1
Q

What’s an integer?

A

A complete number (EX. 5)

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

What’s a float?

A

An un-complete number (EX. 5.5)

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

What’s a string?

A

Sequence of characters

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

Are strings mutable or immutable?

A

Immutable

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

Booleans: What does “and” do?

A

Evaluates if all provided statements are true

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

Booleans: What does “or” do?

A

Evaluates if at least one of many statements are true

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

Booleans: What does “not” do?

A

Flips the bool value

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

What are lists?

A

A data structure for mutable ordered sequences of elements

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

Are lists mutable or immutable?

A

Mutable

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

Are lists ordered?

A

Yes

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

How are lists defined? (What starts and ends the sequence?)

A

[]

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

What does mutability mean?

A

Whether an object can change it’s values after it has been created

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

What does order mean?

A

Whether the order of elements in a sequence matters (and whether this can be used to access elements)

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

Are strings ordered?

A

Yes

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

Why is ordering helpful?

A

Because indexing works well

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

What does print() do?

A

Writes text

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

What does len() do?

A

Returns the length of a sequence

18
Q

Does len() return the index length or intuitive numbers?

19
Q

What is this an example of? ___[1]

20
Q

What is this an example of? ___[1:4]

21
Q

What does type() do?

A

Tells you if it’s a str, int, float

22
Q

What does \n do?

A

Starts a new line

23
Q

Dictionaries: Can they be indexed? If so, how?

A

Yes, through the use of keys

24
Q

Dictionaries: Are they mutable?

25
T or F: The keys of a dictionary are unique
T
26
Strings: what does find() do?
Finds the index at which the element occurs in the sequence
27
Do spaces matter in strings? Do they count when indexing?
YES AND YES
28
Identity operators: What does "in" do?
Evaluates if object/element is in a sequence or "list"
29
What does replace() do?
Can replace a word in a string if set up like x = string.replace(y, "new word")
30
Identity operators: What does "not in" do?
Evaluates if object/element is not include in the sequence or "list"
31
List Methods: what does len() do?
Returns how many elements there are in a list
32
List Methods: what does max() do?
Returns the greatest element in a list
33
List Methods: what does min() do?
Returns the smallest element in a list
34
List Methods: what happened if you use max() or min() when the list contains words/strings?
Will return the last(max) element or first(min) element to occur if list was sorted alphabetically
35
List Methods: When can you not use max() and min()?
When list contains both strings and integers
36
List Methods: What does sorted() do?
Returns the copy of the list in order of smallest to largest
37
List Methods: What does join() do?
Takes a list as an argument, and returns the string consisting of the list elements joined by a separator string(will combine all listed strings)
38
List Methods: T or F; You can only use join for a list made entirely of strings
T
39
List Methods: What does append() do?
Adds an element to the end of the list
40
Attributes of a collection for which using a list would be appropriate
Sortable, add items with .append, items are always indexed with numbers starting at 0
41
Attributes of a collection for which using a set would be appropriate
Order in which items seem to be inconsistent, mutable, add items with .add
42
Attributes of a collection for which using a dictionary would be appropriate
Each item contains two parts, order in which items seem to be inconsistent, can be nested