实现isNum()函数,参数为一个字符串,如果这个字符串属于整数、浮点数或复数的表示,则返回True,否则返回False
def isNum():
try:
a = eval(input('请输入数字:'))
if type(a) != int or type(a) != float or type(a) != complex:
print('True')
except:
print('False')
isNum()
原创
2021-06-19 22:46:14 ·
4257 阅读 ·
1 评论