“перестановки в Python” Ответ

Все перестановки Python

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

ПИТОН ПЕРСИТ

import itertools

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

perm_iterator = itertools.permutations(a, n)

for item in perm_iterator:
    print(item)
Kodi4444

Использование функции перестановок Python на строке

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

Все перестановки Python


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

Cautious Cod

Python все перестановки строки

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

перестановки в Python

T=[i for i in range(8)]
for i in range(8):
             print("T[",i,"]= ",end="")
             T[i]=int(input())
print("Tableau avant permutation")
print(T)
k=7
for i in range(4):
             X=T[i]
             T[i]=T[k]
             T[k]=X
             k=k-1
print("Tableau après permutation")
print(T)
Exuberant Earthworm

Ответы похожие на “перестановки в Python”

Вопросы похожие на “перестановки в Python”

Больше похожих ответов на “перестановки в Python” по Python

Смотреть популярные ответы по языку

Смотреть другие языки программирования