做这题是第一次发现round()的局限性
import math while True: try: num1 = float(input()) num2 = (math.floor(num1*10) % 10) if(num2 >= 5): print(math.ceil(num1)) else: print(math.floor(num1)) except: break
做这题是第一次发现round()的局限性
import math while True: try: num1 = float(input()) num2 = (math.floor(num1*10) % 10) if(num2 >= 5): print(math.ceil(num1)) else: print(math.floor(num1)) except: break