fork download
# IdeaGen v0.1
# License: Public Domain

import itertools

def func(n):
    with open("wordslist.txt") as file:
        words = file.read().splitlines()

    with open('output', 'w') as file:
        text = '\n'.join(map(' '.join, combinations(words, n)))
        file.write(text)

if __name__ == '__main__':
   func(2)
   func(3)

Runtime error #stdin #stdout #stderr 0.01s 27712KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "./prog.py", line 15, in <module>
  File "./prog.py", line 7, in func
FileNotFoundError: [Errno 2] No such file or directory: 'wordlist.txt'