Ask coding questions

← Back to all posts
How do i add a method to where the game ends upon dying?
EvanStewart2

Also when i run the code some of the choices dont run like i wanted, I appreciate all help!

Voters
EvanStewart2
Comments
hotnewtop
sqcodes

suggestion

I think you should add /n to the end of each print like this:

print("you chose jocker"/n)

and then it will line break

ps-I wasn't sure if you were open to suggestions so if so I am sorry.

EvanStewart2

@sqcodes your fine, that would be a good idea, might incorporate that

EvanStewart2

@sqcodes ur fine

The07Coder

Hey there,
I see the comment above answered the question about how to end the script, so I won't repeat said information. But, I do see things to improve in your game. Let me explain:

When you want to check if a user types in something, instead of doing
if answer == "Jocker"
which will only check if the user types in Jocker, you should do:
if answer.upper() == "JOCKER"
which will basically output True if the user types "jocker", "Jocker", "jOcKer" etc.
This will make you code cleaner. If you need any more help on issues, feel free to ask me :)

Geocube101

To end the script just use sys.exit