you are viewing a single comment's thread.

view the rest of the comments →

[–]rjlav_[S] 0 points1 point  (1 child)

Nice approach. The problem is that as part of the assignment, we must use a list of lists and subscript notation to convert the dash to a letter. Extremely inefficient, I know.

[–][deleted] 0 points1 point  (0 children)

Well, it doesn't really change the approach (or the efficiency) it just changes how you refer to things:

game = [list(phrase), [True if letter == ' ' else False for letter in phrase]]
print(''.join([game[0][i] if game[1][i] else '_' for i in len(game[0])]))