Question:
I am using The Big Book of Small Python projects to increase my skills in python, and on the very first project, which is making a simple logic game, On the first try, the code goes all the way however if you get it wrong you it won’t run properly.Here is the code and a description of the game, the while loop with chances is supposed to run for the whole game, until you run out of chances, the second while loop is supposed to run in case user enters below or more than length three for the number
Answer:
EDIT You’re using random.choices, which returns a list
you don’t need to import the
re
moduledo some kind of type checking for your input
use snake case as suggested in PEP8
Better to leverage Pythonic ways for checking values, this should work:
If you have better answer, please add a comment about this, thank you!