subject

#write a function called alter_list. alter_list should have#two parameters: a list of strings and a list of integers.##the list of integers will represent indices for the list of#strings. alter_list should alter the capitalization of all#the words at the designated indices. if the word was all#capitals, it should become all lower case. if it was all#lower case, it should become all capitals. you may assume#that the words will already be all-caps or all-lower case.##for example: ## string_list = ["hello", "world", "how", "are", "you"]# index_list = [0, 2]# alter_list(string_list, index_list) -> # ["hello", "world", "how", "are", "you"]##after calling alter_list, the strings at indices 0 and 2#have switched their capitalization. ##note that it may be the case that the same index is present#in the second twice. if this happens, you should switch the#text at that index twice. for example: ## string_list = ["hello", "world", "how", "are", "you"]# index_list = [0, 2, 2]# alter_list(string_list, index_list) -> # ["hello", "world", "how", "are", "you"]##2 is in index_list twice, so the string at index 2 is#switched twice: capitals to lower case, then back to#capitals.#write your function here! #below are some lines of code that will test your function.#you can change the value of the variable(s) to test your#function with different inputs.##if your function works correctly, this will originally#print: #["hello", "world", "how", "are", "you"]#["hello", "world", "how", "are", "you"]print(alter_list(["hello", "world", "how", "are", "you"], [0, 2]))print(alter_list(["hello", "world", "how", "are", "you"], [0, 2, 2]))

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 18:30, ovoxotas
Which of the following commands is more recommended while creating a bot?
Answers: 1
image
Computers and Technology, 22.06.2019 22:00, robert7248
Competent nonverbal communication involves interacting with others in a manner that is appropriate for which of the following? select all that apply. situation task individuals
Answers: 3
image
Computers and Technology, 24.06.2019 11:00, soystersoce
Under the home tab, where can a user find options to change the bullet style of an outline? in the slides group in the font group in the paragraph group in the drawing group
Answers: 1
image
Computers and Technology, 24.06.2019 21:50, TamB01
Maddie is traveling to india and would like to document her trip for friends and family to access online. what tool would be best? app blog listserver web page
Answers: 1
You know the right answer?
#write a function called alter_list. alter_list should have#two parameters: a list of strings and a...

Questions in other subjects:

Konu
Mathematics, 28.03.2021 04:50