mercredi 8 septembre 2021

Python IF True/False

When "Python" is detected in the text (or not) it outputs either True or False. Now i want to take those and use them to print different statements like "is there" or "is not" but i doesn't work.

Text = "Python for beginners"
print("Python" in Text)

if Text == True:
    print("Its there!")
else:
    print("its not there")

The problem is probably with the if Text == True: statement but I just cant get it right. I already tried if Text is True: and if Text == "True":however nothing worked. So if someone here could help me out id be really happy

Aucun commentaire:

Enregistrer un commentaire