19. Review functions: type == int or type == float


Continuing the discussion from 19. Review: Built-In Functions:

I'm curious as to why you can't type

type(a) == int or float

instead of

type(a) == int or type(a) == float

anyone care to enlighten me?


well, python will evaluate both sides of the or operator:

type(a) == int

given float isn't compared to anything, python will simply analyze if float is considered true or false


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.