Strings & Text Flashcards
What is a string?
a sequence of characters
what are characters?
letters, numbers, punctuation marks, spaces
How are string literals specified
enclosing a sequence on characters with either single or double quotations
why are both double and single quotations able to be used?
able to use apostrophe or quotation marks within the string
what is string length?
number of characters in a string
what is the string length function?
len()
how can you convert numbers into a string?
str()
what is string concatenation?
adding one string onto the end of another with “+”
how do you follow nested function calls?
start from inner most to outermost function and substitute values
what is operator overloading? what is an example of it?
operator performs different functions of variables of different types (ex. ‘+’, ‘*’)
what is string repetition function?
“*” repeats a string as many times as indicated:
dashes = “-“*4
–> output: —-
why is it important to have the str() function?
you can now combine numbers with strings (49ers)
what does python use for characters?
unicode –> characters are stored as integer values
what is an index number?
the character’s assigned number, starting with 0
what is index number operator?
[ ]