Unit 2.6:Strings Flashcards

(11 cards)

1
Q

What is a string?

A

An ordered sequence of characters, which can be letters, numbers, or symbols.

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

What is string indexing?

A

Accessing parts of a string using an index that begins at 0. For example, if aStr = “Python”, aStr[0] will return “P”.

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

What is string slicing (e.g., aStr[0:4])?

A

This will return a portion of the string, including the character at the first index and not including the character at the last index. For aStr = “Python”, aStr[0:4] returns “Pyth”.

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

What is a len() subprogram?

A

A built-in subprogram that returns an integer representing the length of the string (the number of characters it contains).

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

What does Immutability of Strings mean?

A

The concept that once a string has been assigned to a variable, its value cannot be changed. However, the variable can be reassigned a new value.

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

What is String Concatenation?

A

The process of joining strings together using the + operator.

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

What is .upper() and .lower() methods?

A

Operators that return a modified string with all letters converted to upper or lower case, respectively, without changing the original string.

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

What is String Slicing with a Step?

A

An optional third parameter in string slicing that determines the step size when extracting characters. By default, it is set to 1.

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

What is .split() method?

A

A method used when a string is made of several words to break it down into a list of separate words.

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

What is a List Data Type?

A

An ordered, mutable sequence of elements.

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

What is typecasting?

A

A method used to change the data type of a variable to match the operation you want to perform. In Python, you can use built-in functions like int() , str() , float() ,

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