Strings: A Deeper Look Flashcards
(Fill-In) Presentation types _____ and _____ format floating-point and Decimal values in scientific notation.
e, E.
(Fill-In) Presentation type _____ formats a character code as its corresponding character.
c.
(True/False) If you do not specify the alignment, all values displayed in a field are right-aligned by default.
False. Only numeric values are right aligned by default.
(Fill-In) To display all numeric values with their sign, use a(n) _____ in the format specifier; to display a space rather than a sign for positive values use a(n) _____ instead.
+, space character.
(Fill-In) Method _____ returns the number of times a given substring occurs in a string.
count.
(True/False) String method find causes a ValueError if it does not find the specified substring.
False. String method find returns -1 in this case. String method index causes a ValueError.
(Fill-In) Tokens are separated from one another by _____.
delimiters.
(Fill-In) Method ________ returns True if a string contains only letters and numbers.
isalnum.
(Fill-In) Method ________ returns True if a string contains only letters
isalpha.
(Fill-In) The raw string r’\Hi!\’ represents the regular string _____.
’\\Hi!\\’
(True/False) Any string can be a regular expression.
True.
(True/False) The ? quantifier matches exactly one occurrence of a subexpression.
False. The ? quantifier matches zero or one occurrences of a subexpression.
(True/False) The character class [^0–9] matches any digit.
False. The character class [^0–9] matches anything that is not a digit.
(Fill-In) Function ________ finds in a string the first substring that matches a regular expression.
search.
(Fill-In) Preparing data for analysis is called _____ or _____. A subset of this process is data cleaning.
data munging, data wrangling.