第三题
Topic sourcedict = {'1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6}
def charToNum(ch):
return dict[ch]
def strToInt(x, y):
if str(y) in s[:dotIndex]:
return x*10 + y
else:
n = s.find(str(y)) - dotIndex
return x + 0.1**n*y
dotIndex = s.find('.')
return reduce(strToInt, map(charToNum, s.replace('.', '')))
- 1
俯仰瞬间
有大佬帮忙看一下哪里出错了吗?偏差太大了