ENGLISH Implement a function intersperse, which takes two parameters: a non-empty string s and a non-empty list of strings 1. The function should return the string s while the elements from 1 should be inserted one by one in-between the characters in s. Once the last element in 1 has been inserted, the selection should return to the beginning. Consider the assertions given below as examples for using intersperse. def intersperse(s, 1): pass # DO NOT SUBMIT THE LINES BELOW! "H" #assert intersperse ("H", [',']) "H,e,l,1,0" #assert intersperse("Hello", [', #assert intersperse ("Hello", #assert intersperse("Hello", #assert intersperse ("Hello", [ #assert intersperse("Hello", [' == "H,e.1,l.o ]) "He.1l.o" _o_']) == "H-o-e_o_1-o-1_o 1) == "H,e.1-1,0"

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

python will rate u

ENGLISH
Implement a function intersperse, which takes two parameters: a non-empty strings and a non-empty
list of strings 1. The function should return the strings while the elements fromn l should be inserted one by
one in-between the characters in s. Once the last element in 1 has been inserted, the selection should return
to the beginning. Consider the assertions given below as examples for using intersperse.
def intersperse (s, 1):
pass
# DO NOT SUBMIT THE LINES BELOW!
"H"
#assert intersperse("H", [','])
#assert intersperse("Hello", [','])
"H,e,1,1,0"
"H,e.1,1.o
#assert intersperse("Hello", [',', '.'])
"He.1l.o"
#assert intersperse("Hello", ['', '.'])
#assert intersperse("Hello", ['-o-', '_o_'] )
#assert intersperse ("Hello", [',',
"H-o-e_o l-o-1_o_o"
'-'1)
"H,e.1-1,0"
Sald
Transcribed Image Text:ENGLISH Implement a function intersperse, which takes two parameters: a non-empty strings and a non-empty list of strings 1. The function should return the strings while the elements fromn l should be inserted one by one in-between the characters in s. Once the last element in 1 has been inserted, the selection should return to the beginning. Consider the assertions given below as examples for using intersperse. def intersperse (s, 1): pass # DO NOT SUBMIT THE LINES BELOW! "H" #assert intersperse("H", [',']) #assert intersperse("Hello", [',']) "H,e,1,1,0" "H,e.1,1.o #assert intersperse("Hello", [',', '.']) "He.1l.o" #assert intersperse("Hello", ['', '.']) #assert intersperse("Hello", ['-o-', '_o_'] ) #assert intersperse ("Hello", [',', "H-o-e_o l-o-1_o_o" '-'1) "H,e.1-1,0" Sald
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY