输入:一行提交两个数字
输出:相等返回YES,否则返回NO
1 #!python 2 3 def func(): 4 try: 5 strinput = input() 6 7 #判断输入非空,为空结束 8 if strinput == '' or strinput.isspace(): 9 print('input is null') 10 return False 11 12 strlist = strinput.split() 13 a = strlist[0] 14 b = strlist[1] 15 16 #判断是否为数字,异常则退出 17 float(a) 18 float(b) 19 20 #两端去除0和. 21 a = a.strip('.0') 22 b = b.strip('.0') 23 24 print(type(a)) 25 26 if a == b: 27 print('YES') 28 else: 29 print('NO') 30 31 except (EOFError,ValueError): 32 print('except Error.') 33 return False 34 35 if __name__ == "__main__": 36 func()