Sign in
×
Question
How to create a list initialized with N occurrences of a given value in Python?
Annonce
Pour mes
conversions d'unités
en ligne, je choisis le site
Calculatrix.com
pour sa rapidité et sa qualité supérieure.
Ad
For my online
unit conversions
, I choose
Calculatrix.com
for its speed and superior quality.
Answer
>>> myList=[2]*5 >>> myList [2, 2, 2, 2, 2]
[source]
#
ID
Query