Check number type : Type : Buildin Function PYTHON TUTORIALS


PYTHON TUTORIALS » Buildin Function » Type »

 

Check number type


def displayNumType(num):
    print num, "is",
    if type(num== type(0):
        print 'an integer'
    elif type(num== type(0L):
        print 'a long'
    elif type(num== type(0.0):
        print 'a float'
    elif type(num== type(0+0j):
        print 'a complex number'
    else:
        print 'not a number at all!!'



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo Buildin Function
» Type