Review Flashcards

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?

A

Intuitive

19
Q

What is this an example of? ___[1]

A

indexing

20
Q

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

A

Slicing

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?

A

Yes

25
Q

T or F: The keys of a dictionary are unique

A

T

26
Q

Strings: what does find() do?

A

Finds the index at which the element occurs in the sequence

27
Q

Do spaces matter in strings? Do they count when indexing?

A

YES AND YES

28
Q

Identity operators: What does “in” do?

A

Evaluates if object/element is in a sequence or “list”

29
Q

What does replace() do?

A

Can replace a word in a string if set up like x = string.replace(y, “new word”)

30
Q

Identity operators: What does “not in” do?

A

Evaluates if object/element is not include in the sequence or “list”

31
Q

List Methods: what does len() do?

A

Returns how many elements there are in a list

32
Q

List Methods: what does max() do?

A

Returns the greatest element in a list

33
Q

List Methods: what does min() do?

A

Returns the smallest element in a list

34
Q

List Methods: what happened if you use max() or min() when the list contains words/strings?

A

Will return the last(max) element or first(min) element to occur if list was sorted alphabetically

35
Q

List Methods: When can you not use max() and min()?

A

When list contains both strings and integers

36
Q

List Methods: What does sorted() do?

A

Returns the copy of the list in order of smallest to largest

37
Q

List Methods: What does join() do?

A

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
Q

List Methods: T or F; You can only use join for a list made entirely of strings

A

T

39
Q

List Methods: What does append() do?

A

Adds an element to the end of the list

40
Q

Attributes of a collection for which using a list would be appropriate

A

Sortable, add items with .append, items are always indexed with numbers starting at 0

41
Q

Attributes of a collection for which using a set would be appropriate

A

Order in which items seem to be inconsistent, mutable, add items with .add

42
Q

Attributes of a collection for which using a dictionary would be appropriate

A

Each item contains two parts, order in which items seem to be inconsistent, can be nested