dimanche 20 septembre 2020

Why does the if statement return true when the condition is a number? [duplicate]

For example,

if 1:
        print ("True")

prints True as if if 1 is if True.

What is the rationale behind allowing that?

Aucun commentaire:

Enregistrer un commentaire