Strings

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/31

flashcard set

Earn XP

Description and Tags

CSCE 1035

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

32 Terms

1
New cards

index

an integer matching a specific position in a string’s sequence of characters

2
New cards

slice notation

the form is my_str[start:end] and it creates a new string whose value contains the characters of my_str from indices start to end

3
New cards

stride

determines how much to increment the index after reading each element

4
New cards

field width

defines the minimum number of characters that must be inserted into the string

5
New cards

alignment character

determines how a value should be aligned within the width of the field

6
New cards

fill character

used to pad a replacement field when the inserted string is smaller than the field width

7
New cards

precision

indicates how many digits should be included in the output of floating types

8
New cards
9
New cards

replace(old, new)

returns a copy of the string with all occurrences of the substring old replaced by the string new; old and new arguments may be string variables/literals

10
New cards

replace(old, new, count)

same as replace(old, new), but it only replaces the first count occurrences of old

11
New cards

find(x)

returns the index of the first occurrence of item x in string or returns -1; x may be a string variable/literal

12
New cards

find(x, start)

same as find(x), but it begins the search at index start

13
New cards

find(x, start, end)

same as find(x, start), but stops the search at index at end -1

14
New cards

rfind(x)

same as find(x), but it searches the string in reverse, returning the last occurrence in the string

15
New cards

count(x)

returns the number of times x occurs in the string

16
New cards

ASCII table

provides a quick lookup of ASCII values

17
New cards

isalnum()

returns True if all characters in string are lowercase/uppercase letters or the numbers 0-9

18
New cards

isdigit()

return True if all characters are the numbers 0-9

19
New cards

islower()

returns True if all cased characters are lowercase letters

20
New cards

isupper()

returns True if all cased characters are uppercase letters

21
New cards

isspace()

returns True if all characters are whitespace

22
New cards

startswith(x)

returns True if the string starts with x

23
New cards

endswith(x)

returns True if the string ends with x

24
New cards

capitalize()

returns a copy of the string with the first character capitalized and the rest lowercased

25
New cards

lower()

returns a copy of the string with all characters lowercased

26
New cards

upper()

returns a copy of the string with all characters uppercased

27
New cards

strip()

returns a copy of the string with leading and trailing whitespace removed

28
New cards

title()

returns a copy of the string as a title, with first letters of words capitalized

29
New cards

split()

splits a string into a list of tokens

30
New cards

token

a substring that forms a part of a larger string

31
New cards

separator

a character/sequence of characters that indicates where to split the string into tokens

32
New cards

join()

joins a list of strings together to create a single string