关于作者

Discuss / Python / 交作业

交作业

Topic source

隔壁你王叔866

#1 Created at ...

from functools import reduce def change(s): global d1 d1 = [] for x in s : if x == ".": continue else : d1.append(x) return str2float(d1)

def xiaoshu(o): global c ,d2,l1 c = 0 d2 = [] for x in o : d2.append(x) l1 =d2[::-1] for x in l1: if x ==".": break else: c = c+1

def str2float(s) : global n def fn1(x,y): return x10+y def char2num(s): return {'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9}[s] n = reduce(fn1,map(char2num,s ) ) print(n/(10*c) )

def fin(s): xiaoshu(s) change(s) return ("")

jieguo = input("请输入要转换的字符:") print(fin(jieguo) )


  • 1

Reply

WARNING: You are using an old browser that does not support HTML5. Please choose a modern browser (Chrome / Microsoft Edge / Firefox / Sarafi) to get a good experience.