It's quite simple to understand really:
- Go over each
- If
- Otherwise, put a
Does it make it easier to read if you abstract the
- Go over each
letter
in word
- If
letter
is in used_letters
, put it inside the new list- Otherwise, put a
"-"
inside the new list.Does it make it easier to read if you abstract the
if
and else
into a function? That is, something likedef character(letter): if letter in used_letters: letter else: "-" word_list = [character(letter) for letter in word]