Chapter 8: More About Strings

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/28

flashcard set

Earn XP

Description and Tags

Vocabulary flashcards covering string operations, methods, immutability, slicing, and tokenization in Python as presented in Chapter 8.

Last updated 11:49 AM on 6/21/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

29 Terms

1
New cards

Sequences

A category of data types in Python; because strings belong to this category, many tools that work with other sequence types also work with strings.

2
New cards

Indexing

A method to access individual characters in a string where each character has a position number starting at 00. Format: character=my_string[i]\text{character} = \text{my\_string}[i].

3
New cards

IndexError

An exception that occurs if you try to use an index that is out of range for the string, likely happening when a loop iterates beyond the end of the string.

4
New cards

len(string) function

A function used to obtain the length of a string, which is useful to prevent loops from iterating beyond the end of the string.

5
New cards

Concatenation

The process of appending one string to the end of another using the ++ operator or the augmented assignment operator +=+=.

6
New cards

Immutable

A characteristic of strings meaning they cannot be changed once they are created; operations like concatenation create a new string rather than modifying the existing one.

7
New cards

Slice

A span of items taken from a sequence, also known as a substring. Format: string[start:end]\text{string}[\text{start} : \text{end}].

8
New cards

in operator

An operator used to determine whether one string is contained in another string. General format: string1 in string2\text{string1 in string2}.

9
New cards

not in operator

An operator used to determine whether one string is not contained in another string.

10
New cards

isalnum()

Returns true if the string contains only alphabetic letters or digits and is at least one character in length; returns false otherwise.

11
New cards

isalpha()

Returns true if the string contains only alphabetic letters and is at least one character in length; returns false otherwise.

12
New cards

isdigit()

Returns true if the string contains only numeric digits and is at least one character in length; returns false otherwise.

13
New cards

islower()

Returns true if all of the alphabetic letters in the string are lowercase and the string contains at least one alphabetic letter.

14
New cards

isspace()

Returns true if the string contains only whitespace characters (spaces, newlines \text{\n}, and tabs \text{\t}) and is at least one character in length.

15
New cards

isupper()

Returns true if all of the alphabetic letters in the string are uppercase and the string contains at least one alphabetic letter.

16
New cards

lower()

Returns a copy of the string with all alphabetic letters converted to lowercase.

17
New cards

lstrip()

Returns a copy of the string with all leading whitespace characters (spaces, newlines \text{\n}, and tabs \text{\t}) removed from the beginning.

18
New cards

rstrip()

Returns a copy of the string with all trailing whitespace characters removed from the end of the string.

19
New cards

strip()

Returns a copy of the string with all leading and trailing whitespace characters removed.

20
New cards

upper()

Returns a copy of the string with all alphabetic letters converted to uppercase.

21
New cards

endswith(substring)

A search method that returns True if the string ends with the specified substring; otherwise returns False.

22
New cards

find(substring)

Searches for a substring within the string and returns the lowest index of the substring, or 1-1 if the substring is not contained in the string.

23
New cards

replace(old, new)

Returns a copy of the string where every occurrence of the string 'old' is replaced with the string 'new'.

24
New cards

startswith(substring)

A search method that returns True if the string starts with the specified substring; otherwise returns False.

25
New cards

Repetition operator

The ×\times symbol (*) when applied to a string (left operand) and an integer (right operand) to join multiple copies of the string together.

26
New cards

split method

A method that returns a list containing the words in the string, using a space as the default separator or a specific character passed as an argument.

27
New cards

Tokens

Substrings that are separated by a special character within a larger string.

28
New cards

Delimiter

The separating character used in a string to distinguish between individual tokens.

29
New cards

Tokenizing

The process of breaking a string into tokens and storing them as individual items.