Using Python : I would like some assistance with this Funtion from the describe
ID: 3787340 • Letter: U
Question
Using Python : I would like some assistance with this Funtion from the describe information:
Q: Function Design Recipe Following the Function Design Recipe, write a function that satisfies this description: This function returns a string containing a given word repeated a given number of times. For example, someone should be able to call the function to repeat "Marcia " three times and the function should return "Marcia Marcia Marcia ", or call the function to repeat "Buffalo " eight times and have it return "Buffalo Buffalo Buffalo Buffalo Buffalo Buffalo Buffalo Buffalo ".
Explanation / Answer
def func(str,count):
li=[]
for i in range(count):
li.append(str)
return li
print func('maria',5)
it will print ['maria', 'maria', 'maria', 'maria', 'maria']
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.