Why does the creation of this list in the coding environment cause a "Code ran out of execution time" error?
the same list is created in two different ways, but one creation leads to that error.
method one (leads to an error):
from itertools import permutations nums = [2, 1, 0, 0, -1, -1, -2, -2, -3, 7] perms = list(permutations(nums))
method two (no error):
from itertools import permutations nums = [2, 1, 0, 0, -1, -1, -2, -2, -3, 7] perms = permutations(nums)
the first method seems to create a list from a list, but the result seems to be the same.
So where does the error happens?
(to check if the output is the same, a permutation of up to 9 values can be used.
the runtime error happens when at least 10 values are permutated.)