I need help in this

Hello, there!

There are some issues with your code.

  1. It’s not advisable to use key words (or similar) in your variable names… so true is not a good variable name (the Python boolean is True ). Try using names that give you a better idea of the variable will hold. For this specific case, I’d use something like user_reply , for example. Same goes for command . This is a keyword in Python, so avoid using them.

  2. According to Python PEP, variables should be in lowercase… so Name is not very pythonic. This is to keep style. Code will work no matter how you write it. Check this: How to Write Beautiful Python Code With PEP 8 – Real Python

  3. The Game variable is holding nothing… it’s just an empty string.

  4. Observe that your true variable is holding the user response… that’s the one you have to check in your WHILE loop… but you are not. So, make sure you check the user response to re-direct your code execution.

  5. And this is perhaps your biggest issue: the WHILE loop is only checking ONCE if the player wants to play or not! And you need to make this part of the loop. SO… Here is a small piece of code I just wrote. It’s not complete (use it as a guide). Analize it and modify it as you need…

a

Let me know how you solve the game, and post it here!

1 Like