“Permutacje Python” Kod odpowiedzi

Permutacje Python

import itertools
print(list(itertools.permutations([1,2,3])))
Smiling Sable

Permutacja Pythona

import itertools

a = [1, 2, 3]
n = 3

perm_iterator = itertools.permutations(a, n)

for item in perm_iterator:
    print(item)
Kodi4444

Korzystanie z Python Permutaction Funkcja na liście

from itertools import permutations
a=permutations([1,2,3,4],2) 
for i in a: 
   print(i)
Outrageous Ostrich

Korzystanie z Python Permutaction Funkcja na ciągu

from itertools import permutations 
string="SOFT"
a=permutations(string) 
for i in list(a): 
   # join all the letters of the list to make a string 
   print("".join(i))
Outrageous Ostrich

Wszystkie permutacje Python


import itertools
list(itertools.permutations([1, 2, 3]))

Cautious Cod

Python Wszystkie permutacje sznurka

>>> from itertools import permutations
>>> perms = [''.join(p) for p in permutations('stack')]
>>> perms
Worrisome Wallaby

Odpowiedzi podobne do “Permutacje Python”

Pytania podobne do “Permutacje Python”

Więcej pokrewnych odpowiedzi na “Permutacje Python” w Python

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu