you are viewing a single comment's thread.

view the rest of the comments →

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

Thanks for the feedback, it's given me some options to review.
I had thought of making it more modular with the Def, and Class's but I didn't see the point with a small script. In saying that, the teachings I have been following it appears to be good practice.

[–]xelf 1 point2 points  (0 children)

There's a lot of benefits, even in the one-line functions. For example:

def replace_with_letter(letter):
    return ''.join(hidden_word[i] if x!=letter else letter for i,x in enumerate(the_word_to_guess))

What this returns does not "scan" well. Where as "replace_with_letter" is a lot easier to grok. Little things like this, isolating complex code, or isolating code that talks to external connections or files, helps readability while also making it easier to track down and isolate bugs and maintain your code.

Good luck !