jeudi 3 septembre 2015

What is the logic behind types returning true?

Am I right in my understanding that the if statement will only 'execute' if it evaluates True?

If so, what is the purpose of types returning True?

What is the logic behind this rule? And can someone give me an example of where it would be useful?

example:

""" Example """

def test(x):
    if float:
        print("success")

test(9)
test('\ntesting')

Returns:

enter image description here

Aucun commentaire:

Enregistrer un commentaire