Anonymous user
Test integerness: Difference between revisions
→{{header|Python}}: Use is_integer()
(→{{header|Python}}: Updated to handle ints, floats, and complex types.) |
(→{{header|Python}}: Use is_integer()) |
||
Line 24:
=={{header|Python}}==
<lang python>>>> def isint(f):
return complex(f).imag == 0 and
>>> [isint(f) for f in (1.0, 2, (3.0+0.0j), 4.1, (3+4j), (5.6+0j))]
|