Answers for "how to repeat same append n times in list python"

0

how to repeat same append n times in list python

# Python3 code to demonstrate 
# to add multiple similar values
# using extend() + itertools.repeat()
from itertools import repeat
  
# using extend() + itertools.repeat() to add multiple values
# adds 3, 50 times.
res = []
res.extend(repeat(3, 50))
  
# printing result
print ("The filtered list is : " + str(res))
Posted by: Guest on May-09-2021

Code answers related to "how to repeat same append n times in list python"

Python Answers by Framework

Browse Popular Code Answers by Language