Splitting, Concatenating and joining strings
The minsplit parameter to split( ) specifies the minimum number of splits to make to the inner string:
False
If you want to transform a list of strings input_list into a string with a comma between each item, which of the following would you give as the input to join( )? input_list = ['a', 'b', 'c'] ','.join(input_list) 'a,b,c'
input_list
Which of the following would separate a string input_string on the first 2 occurrences of the letter "e"?
input_string.split('e', 2) input_string.split('e', maxsplit=2)
which of the following mathematical operators can be used to concatenate strings?
+ *
In Python, strings are
Str objects and immutable
Python strings have property called "immutability". What does this mean?
Strings in Python can't be changed
Write the code for a Python function expand(x) that takes a list of strings, concatenates them, and returns the resulting string repeated three times:
def expand(x): return ' '.join(x) * 3