def format_name(s):
return s.lower().capitalize()
print map(format_name, ['adam', 'LISA', 'barT'])
return s.lower().capitalize()
print map(format_name, ['adam', 'LISA', 'barT'])
2018-03-14
已采纳回答 / 慕哥5335383
print reduce(prod,[2,5,7,12])应该跳出程序后,再执行,既回车跳出程序,在标识符后输入print reduce(prod,[2,5,7,12])<...图片...>
2018-03-13
print(sorted(L,key=lambda Student:(-Student.score,Student.name)))
2018-03-13
#类方法调用类的私有变量
@classmethod
def how_many(cls):
return cls.__count
@classmethod
def how_many(cls):
return cls.__count
2018-03-13
import math
def add(x, y, f):
return f(x) + f(y)
print add(25, 9, math.sqrt)
def add(x, y, f):
return f(x) + f(y)
print add(25, 9, math.sqrt)
2018-03-12
import json
class Students(object):
def __init__(self):
pass
def read(self):
s=r'["Tim", "Bob", "Alice"]'
return s
s = Students()
print json.load(s)
class Students(object):
def __init__(self):
pass
def read(self):
s=r'["Tim", "Bob", "Alice"]'
return s
s = Students()
print json.load(s)
2018-03-12