Announcement

Collapse
No announcement yet.

word unscrambler function

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • word unscrambler function

    a function that unscrambles a word

    def unscramble(word: str, lst: list):
    pook = []
    for i in filter(lambda x: len(x) == len(word), lst):
    possible = True
    letters = {}
    for ltr in i:
    if ltr in letters:
    letters[ltr] += 1
    else:
    letters[ltr] = 1
    for ltr in letters:
    if letters[ltr] != word.count(ltr):
    possible = False
    break
    if possible:
    pook.append(i)
    return pook

    and last is the list of words or that the function is gonna use to unscramble the word for more check this out bestwordunscrambler
Working...
X