Here’s my code:
I’ve spent around 5 hours today working on how to add a repeat feature (e.g "Play again? y/n).
However, everything that I’ve tried hasn’t worked. Also my code in general could use some improvements as well. Help would be GREATLY appreciated.
ask user whether finished
An unfinished pseudo-code placeholder, maybe?
I wrote it, it’s not from their code.
Also, regarding general improvements, there’s a lot of repeated code around difficulty, so maybe put descriptions of difficulties somewhere, and then refer to that?
difficulties = [
defeat_msg="^ Try again - You can do it ^",
victory_msg="^ Have a go at Medium difficulty next time ^",
lives = difficulty.lives
if correct == 20:
Whenever something visually looks repeated, then, whatever logic went into writing that repeated code could go directly into the code instead, like storing data in lists or other data structures and then looking up the appropriate one or iterating through them all or whatever the situation calls for.