Sign in
Log inSign up

Can someone explain ?

Umesh Kumar's photo
Umesh Kumar
·Jan 3, 2018
from itertools import permutations

word, num = input().split(" ")
permutations = list(permutations(word, int(num)))
permutations.sort()

[print("".join(i)) for i in permutations]

i don't understand the last line why the [ ] brackets.

Hassle-free blogging platform that developers and teams love.
  • Docs by Hashnode
    New
  • Blogs
  • AI Markdown Editor
  • GraphQL APIs
  • Open source Starter-kit

© Hashnode 2024 — LinearBytes Inc.

Privacy PolicyTermsCode of Conduct