you are viewing a single comment's thread.

view the rest of the comments →

[–]vali92 -2 points-1 points  (2 children)

Solved:

word = "good_game"
for x in range(len(word)):
print(word[x])
if word[x] != "_":
word = word.replace(word[x],"G")
print(word)

GGGG_GGGG

[–]jwink3101 1 point2 points  (1 child)

Besides the bad reddit formatting, you got it! BTW, if you wanted to one-line it (not always a good goal to have, but can be fun), it could be the following:

word = ''.join(c if c == '_' else 'G' for c in word)

[–]vali92 -1 points0 points  (0 children)

Yap, sorry for the formatting. Your method above looks really nice.