r'["Tim", "Bob", "Alice"]'这代表一个字符串吗?
2016-09-08
def cmp_ignore_case(s1, s2):
return cmp(s1.upper(),s2.upper())
print sorted(['bob', 'about', 'Zoo', 'Credit'], cmp_ignore_case)
return cmp(s1.upper(),s2.upper())
print sorted(['bob', 'about', 'Zoo', 'Credit'], cmp_ignore_case)
2016-09-08
def format_name(s):
return s[0].upper+s[1:].lower()
print map(format_name, ['adam', 'LISA', 'barT'])
哪里不对么,输出就说错误,本地输出正常
return s[0].upper+s[1:].lower()
print map(format_name, ['adam', 'LISA', 'barT'])
哪里不对么,输出就说错误,本地输出正常
2016-09-07
提交的时候提示答案错误,谁帮我看一下哪里错了?谢谢
def calc_prod(lst):
def cProd():
cp = 1
for f in lst:
cp *= f
return cp
return cProd
f = calc_prod([1, 2, 3, 4])
print f()
def calc_prod(lst):
def cProd():
cp = 1
for f in lst:
cp *= f
return cp
return cProd
f = calc_prod([1, 2, 3, 4])
print f()
2016-09-05