Question: Write a function merge(A, B, sep) to merge two lists of text strings A and B using the separator sep. Use the docstring Merges two
Write a function merge(A, B, sep) to merge two lists of text strings A and B using the separator sep.
Use the docstring """Merges two lists of text strings using a separator sep""".
Do not change the main program. Expected output:
|
Beginning of WW1: 1914 End of WW1: 1918 Beginning of WW2: 1939 End of WW2: 1945 Beginning of Cold War: 1947 End of Cold War: 1991 |
# Main program (do not change): events = ["Beginning of WW1", "End of WW1", "Beginning of WW2", "End of WW2", "Beginning of Cold War", "End of Cold War"] years = ["1914", "1918", "1939", "1945", "1947", "1991"] merged = merge(events, years, ": ") for x in merged: print(x)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
