DEV Community

Discussion on: Python Loop Troubles

Collapse
 
hqloi21 profile image
QLoi

I wanted to help but I couldn't see any attachment in your post.
Would you mind edit your post?

Collapse
 
solidsnakelov3r profile image
Brooke :3

Oh I'm sorry I just edited it now thank you for telling me! I wasn't able to upload the second photo but I hope this helps!

Collapse
 
hqloi21 profile image
QLoi

There are a few problems with your code.

  1. The while condition logic is not wrong. It should be 'and' not 'or'.
  2. The if logic in the while loop is not the same as the one above it. I assume you want to run the code once, then if the choice is wrong, then you asking the user again, right? If so, what you can do is just start the while loop without condition, then break out of the loop if the user inputted the right answer.
  3. You don't need to check if the user is the right format or not. Keep the list value lower case, then just convert whatever the user inputted to lower case before checking with the list values.

I hope my answer is clear enough.

Thread Thread
 
solidsnakelov3r profile image
Brooke :3

Yes, it was very clear!! I can't thank you enough my program actually works now, thank you again and have a wonderful day!

Thread Thread
 
hqloi21 profile image
QLoi

Glad you worked it out!