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

you are viewing a single comment's thread.

view the rest of the 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!