标签:src NPU class ima inpu pre mamicode += 大小
差了三天的题了,得赶紧补上
1 num,inx = input().split("E") 2 out = "" if num[0] == "+" else "-" #输出的正负号 3 a,de = num[1:].split(".") 4 num0 = a+de 5 num_ling = int(inx[1:]) # 指数大小 6 q = len(de) # 小数部分位数 7 if num_ling == 0: # 指数为零 8 out += num[1:] 9 elif inx[0] == "+": 10 w = num_ling - q 11 if w < 0: 12 out += num0[:(num_ling+1)] + "." + num0[(num_ling+1):] 13 else: # 补零 14 out += num0 + "0" * w 15 else: 16 out = out + "0." + "0" * (num_ling-1) + num0 #指数小于零 17 print(out)
标签:src NPU class ima inpu pre mamicode += 大小
原文地址:https://www.cnblogs.com/SCP-514/p/13291929.html