Q&A Discussions
I need to design a recursive function called replicate recurĀ which will receive two arguments:Ā timesĀ which is the number of times to repeat and dataĀ which is theĀ number or stringĀ to be repeated.
The function should return an array containing repetitions of the data argument.
For instance,Ā replicate_recur (3, 5)Ā should return [5,5,5].
If the timesĀ argument is negative or zero, return an empty array. If the argument is invalid,Ā raise ValueError.
0 Votes
4 AnswersHot today
Is this realistic enough?
1 Votes
"Whatās the best way to combine creativity and coding? Can storytelling improve web apps?"
1 Votes
Need friends
0 Votes
Python
1 Votes