Need in python thank youSolutiondef permutationslst if lenls
Need in python, thank you.
Solution
def permutations(lst):
if len(lst)==0 or len(lst)==1:
return [lst]
l = []
for i in range(len(lst)):
m = lst[i]
rem_lst = lst[:i] + lst[i+1:]
for p in permutations(rem_lst):
l.append([m]+p)
return l
print permutations([1, 2, 3, 4])
![Need in python, thank you.Solutiondef permutations(lst): if len(lst)==0 or len(lst)==1: return [lst] l = [] for i in range(len(lst)): m = lst[i] rem_lst = lst[ Need in python, thank you.Solutiondef permutations(lst): if len(lst)==0 or len(lst)==1: return [lst] l = [] for i in range(len(lst)): m = lst[i] rem_lst = lst[](/WebImages/14/need-in-python-thank-yousolutiondef-permutationslst-if-lenls-1021511-1761528416-0.webp)