Splitting, Concatenating and joining strings

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

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


संबंधित स्टडी सेट्स

Chapter 36: Introduction to the Nervous System

View Set

Chapter 3 - American Free Enterprise

View Set

Chapter 3: Managing The Information Systems Infrastructure and Services

View Set

MAN 3303 Week 4 SmartBook (Chapters 8-9)

View Set

Chapter 12: Riskier Mutual Funds Products

View Set

Module 1: Private Retirement Plans: Background and Context

View Set

EMPA Mid Term 1 of 2 (Combined MEM6210-13 Sets)

View Set