strings in python Flashcards

1
Q

Are strings immutable?

A

Strings are immutable, because you can’t modify them.

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

What types of quotation marks can be used with strings?

A

Single, double, and triple quotation marks.

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

What is the string method call to use to break strings into separate lines?

A

The .split(‘ ‘) method, which includes the newline character, breaks strings into separate lines.

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

What two string methods can you use to check to see whether a word exists in a string?

A

The .find() and .count() methods.

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

What is a problem you might run into when you use % for formatting?

A

The code can be harder to read when many replacements are needed.

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

How can you round down a number when you use f-strings?

A

Use the round() function inside the string, enclosed in braces ({}).

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