how to repeat same append n times in list python

Solutions on MaxInterview for how to repeat same append n times in list python by the best coders in the world

showing results for - "how to repeat same append n times in list python"
Yannick
16 Oct 2017
1# Python3 code to demonstrate 
2# to add multiple similar values
3# using extend() + itertools.repeat()
4from itertools import repeat
5  
6# using extend() + itertools.repeat() to add multiple values
7# adds 3, 50 times.
8res = []
9res.extend(repeat(3, 50))
10  
11# printing result
12print ("The filtered list is : " + str(res))
13