dimanche 10 mai 2020

how not to enter or enter if block in python [duplicate]

As far as I know, basic concept of if statements are as follows:

if `condition`
     print("hello")

If the condition is True I will see hello as output, however if condition is None or False. I will not see hello.

However let's replace condition with an object or variable.

if "test"
     print("hello")

Why do I still see hello as an output?

Aucun commentaire:

Enregistrer un commentaire