Discuss / Python / 作业打卡(想了很久)

作业打卡(想了很久)

Topic source

def fn(x,y): return x*10+y

def str2float(s): intsum=list(map(int,s[:s.index(".")])) floatsum=list(map(int,s[s.index(".")+1:])) sum1=reduce(fn,intsum) sum2=reduce(fn,floatsum) temp=sum2/(10**len(floatsum)) endsum=sum1+temp return endsum


  • 1

Reply