I found some Python code of a hangman game. I came accross the following line of code and I'm unable to make any sense of it.
# here's the initial values of the variables
guessWord = random.choice(listOfWords)
blanks = "-" * len(guessWord)
alreadyGuessed = set()
# This is the line I fail to understand:
blanks = "".join([char if char in alreadyGuessed else "-" for char in guessWord])
I would be glad if you explain it's use.