Question 8 Not answered Mark 0.00 out of 30.00 Write a function repList that rec
ID: 3721393 • Letter: Q
Question
Question 8 Not answered Mark 0.00 out of 30.00 Write a function repList that receives two input arguments: a list and a number which tells the times each element in the list should be duplicated. The function should then return the resulting list. If the second input argument is O(zero) then the function should return an empty list. For Example: ist (5, 4, 3, 2, 1 print (replist (List, 2)) Flag question Output: (s, 5, 4, 4, 3, 3, 2, 2, 1, For Example: print replist (hist,3 Output: For Example: ist te print replist (List,4)) Output: For Example: ist -te print replist (List, e) Output: [?Explanation / Answer
def repList(list, n):
newList = []
for i in list:
for j in range(n):
newList.append(i)
return newList
list = [5, 4, 3, 2, 1]
print(repList(list, 2))
**Comment for any further queries.