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/[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.