Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

If condition is not working for some reason

while True:
    inp = input("Say hi bruh!: ").lower
    if inp == "hi":
        print("Okay")
        break
    else:
        print("Not Okay")
        continue

It either doesn’t enter the condition or something. I know Python for a while and can’t figure out what is wrong.

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

As Joran stated in the comment, you’re missing the parentheses after lower. Once you add those your loop will work. Python cannot successfully interpret your variable inp without them.

while True:
    inp = input("Say hi bruh!: ").lower()
    if inp == "hi":
        print("Okay")
        break
    else:
        print("Not Okay")
        continue
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading