from itertools import combinations
word = "python"
result = combinations(word, 3)
lst = [' '.join(i) for i in result]
for e in lst:
print(e)
'''
run:
p y t
p y h
p y o
p y n
p t h
p t o
p t n
p h o
p h n
p o n
y t h
y t o
y t n
y h o
y h n
y o n
t h o
t h n
t o n
h o n
'''