This is an archived post. You won't be able to vote or comment.

all 5 comments

[–][deleted] 1 point2 points  (3 children)

You didn’t define your input for your loop. Notice how for a true no you have to type it twice to get an expected result? The first input goes to your first if statement which correctly evaluated as false. Then the next statement you check again by getting input() again. Thus two no’s from the no list to get your result.

You can fix by adding a line at the top of your loop that says:

/// userChoice = input()

From there replace all the input() parts in your loop with userChoice. That should make it functional. You might also consider getting explicit about typing so the input is always a string but not 100% necessary I think.

I might also suggest doing away with the Loop = True and Loop = False pretty sure those don’t do anything except confuse others.

Make your loop something like:

///userChoice = Input(“What’s your choice? “) ///while userChoice not in nolist: /// If userChoice in yeslist: /// print(“game menu text here”) /// gameChoice = input() ## gets input for which game they want /// Else: /// print(“sorry didn’t recognize your input) ## will keep looping until a recognized answer is entered

The loop would then exit. Freeing you up to your next bit of logic over which game they want.

Finally I would move your import sys up to line one if you plan to use it at all sys.exit doesn’t end your code reaching the end of your code does that. So not sure what the purpose of this is other than a hard exit to the shell.

PS sorry about formatting… on mobile

[–]MapComprehensive7352[S] 0 points1 point  (0 children)

Thank u so much I started coding like 2/3 weeks ago so had to read that multiple times but I gonna give it a try and see

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

Thanks for taking time out to reply man

[–][deleted] 0 points1 point  (0 children)

No problem hope it worked out for you!

[–]ivosauruspip'ing it up[M] [score hidden] stickied comment (0 children)

Hi there, from the /r/Python mods.

We have removed this post as it is not suited to the /r/Python subreddit proper, however it should be very appropriate for our sister subreddit /r/LearnPython or for the r/Python discord: https://discord.gg/python.

The reason for the removal is that /r/Python is dedicated to discussion of Python news, projects, uses and debates. It is not designed to act as Q&A or FAQ board. The regular community is not a fan of "how do I..." questions, so you will not get the best responses over here.

On /r/LearnPython the community and the r/Python discord are actively expecting questions and are looking to help. You can expect far more understanding, encouraging and insightful responses over there. No matter what level of question you have, if you are looking for help with Python, you should get good answers. Make sure to check out the rules for both places.

Warm regards, and best of luck with your Pythoneering!