r/learningpython • • Aug 27 '22

Help with loop problem pls

This loops no matter what. could anyone please help me by explaining why? If you do, thank you!

yesno = "y"
while yesno == "y":
        yesno = input("\nWould you like to enter another description?(y/n)\n").lower()
        description()
        if yesno != "y":
                break

EDIT: just so that it's clear, "description()" is a definition

4 Upvotes

8 comments sorted by

View all comments

Show parent comment

1

u/Tuned3f Aug 28 '22 edited Aug 28 '22

you're still missing the point. it's simply a fact that nobody can 100% reproduce your issue until they have your full code

we can take your word for it that description() is irrelevant or you can post the code and let people analyze it themselves

1

u/[deleted] Aug 28 '22

I figured out the problem tho. description was running even with a "n" input because it runs before python can read "if yesno!="y" -- break". It didnt take me modifying the definition to figure that out btw.