展开全部
def split(num):
if isinstance(num, int) or isinstance(num, float):
num = str(num)
res = num.split(".")[0]
if len(res)<5:
print "%s is less than ten thousand." % num
else:
print "The ten thousand bit number of %s is %s." % (num, res[-5:-4])
else:
print "%s is not int or float." % str(num)
return None
split("aaaa")
split(123546)
split(123)
split(222.33)
split(987654321.66)
运行32313133353236313431303231363533e59b9ee7ad9431333337383866结果:
aaaa is not int or float.
The ten thousand bit number of 123546 is 2.
123 is less than ten thousand.
222.33 is less than ten thousand.
The ten thousand bit number of 987654321.66 is 5.