while(1):
temp = input("输入一个数字")
num = float(temp)
if num >= 0:
if num - int(num) >= 0.5:
print('小甲鱼的答案',end ='')
print(int(num + 0.5))
num = int(num) + 1
print('我的答案',end ='')
print(num)
else:
print('小甲鱼的答案',end ='')
print(int(num + 0.5))
print('我的答案',end ='')
print(int(num))
else:
if int(num) - num > 0.5:
print('小甲鱼的答案',end ='')
print(int(num + 0.5))
print('我的答案',end ='')
num = int(num) - 1
print(num)
else:
print('小甲鱼的答案',end ='')
print(int(num + 0.5))
print('我的答案',end ='')
print(int(num))
这样应该没错了 |