Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started