Question: Task 1: Programming exercise 1 Write a function called repeater(s1, s2, n) that given two strings s1 and s2 and an integer n returns a

Task 1: Programming exercise 1 Write a function called repeater(s1, s2, n) that given two strings s1 and s2 and an integer n returns a string that starts with an underscore ('_'), then s1 and s2 alternate n times, then ends with an underscore. (For those who know loops: you may not use loops to solve this questions.) Testing your code: Here is what the output of your function should look like when you make the following function calls: (4) repeater('AAA', 'x', 3) '_AAAXAAAXAAAX_' [5] repeater('+', '--', 30) '_+--+--+--+--+--+--+--+--+--+--+ +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+- repeater('T', '1_1', 100) E T1_lti_lti_lti_lti_lti_lti_lti_lti_lti_lti_lti_lti_lti_lti_lti_lti_lti_lti_lti_17 8 Task 1: Programming exercise 1 Write a function called repeater(s1, s2, n) that given two strings s1 and s2 and an integer n returns a string that starts with an underscore ('_'), then s1 and s2 alternate n times, then ends with an underscore. (For those who know loops: you may not use loops to solve this questions.) Testing your code: Here is what the output of your function should look like when you make the following function calls: (4) repeater('AAA', 'x', 3) '_AAAXAAAXAAAX_' [5] repeater('+', '--', 30) '_+--+--+--+--+--+--+--+--+--+--+ +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+- repeater('T', '1_1', 100) E T1_lti_lti_lti_lti_lti_lti_lti_lti_lti_lti_lti_lti_lti_lti_lti_lti_lti_lti_lti_17 8
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
