本题要求从键盘输入一个字符串,判断该串是否属于整数、浮点数或者复数的表示

输入格式:

输入一个字符串

输出格式:

输出yes或no

输入样例:

-299

输出样例:

yes
a = input()

try:
    a = eval(a)
    if type(a) == int or type(a) == float or type(a) == complex:
        print('yes')
    else:
        print('no')
except:
    print("no")

  

相关文章:

  • 2022-12-23
  • 2022-01-21
  • 2022-12-23
  • 2022-12-23
  • 2021-05-28
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-03
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案