Python Strings & String Methods | Quizlet

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/19

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

20 Terms

1
New cards

String

A series of letters, numbers, or characters surrounded by quotation marks.

2
New cards

String Literal

Another word for string. "Hello" is a string literal.

3
New cards

Multiline Strings

A large amount of text with THREE sets of quotation marks at the beginning and end.

4
New cards

Methods

keywords which a program can use to modify data within a variable.

5
New cards

.lower( )

a string method that will cause all of the text to print lowercase. print(string_name.lower())

6
New cards

.upper( )

a string method that will cause oll of the text to pring in uppercase. print(string_name.upper())

7
New cards

.replace("cool" , "fun" )

a string method that will switch all instances of "cool" with the string "fun". print(string_name.replace( “cool“, “fun“)

8
New cards

.strip( )

a string method used to remove any excess white space at the beginning and end of a string.

print(string_name.strip())

9
New cards

Index Number

Measures what position a character or item is in the sequence. Indexing begins counting at zero.

10
New cards

slice( int start(inclusive), int end(exclusive))

A string method that uses indexes to print out specific parts or "slices" of a string. sub = slice (3,6)

print(string_name[sub])

11
New cards

.split( )

A string method that will separate or "split" a string into a list.

<p>A string method that will separate or "split" a string into a list.</p><p></p>
12
New cards

len( )

A string method that returns how many characters the string is long.

13
New cards

.find( )

A string method that returns the index value of a certain character in a string.

print(string_name.find(“T“))

14
New cards

.rfind( )

Find the last instance of a substring in a string

<p>Find the last instance of a substring in a string</p>
15
New cards

Concatenate

To join strings together

16
New cards

Application Programming Interface(API)

The set of rules the language follows to interact with other programs. The API also lists all methods in the language, and how they function

17
New cards

startswith(string)

returns true if the string starts with the argument 

18
New cards

endswith(string)

returns true of the string ends with the argument

19
New cards

charAt(int)

returns the character at index value 

20
New cards

title()

returns a new string with all first characters of words capitalised, and every other character in lowercase