How to use 'python create list with n elements' in Python

Every line of 'python create list with n elements' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
38def fun(x, N):
39 return make_list(*[x for _ in range(N)])
12def fill_list(dims, l):
13 if len(dims) == 1:
14 for i in xrange(dims[0]):
15 if callable(init):
16 l[i] = init()
17 else:
18 l[i] = init
19 else:
20 for i in xrange(dims[0]):
21 fill_list(dims[1:], l[i])

Related snippets