摘要:
def longestCommonPrefix(strs): if len(strs)==0: return '' elif len(strs)==1: return strs[0] else: b=sorted(strs,key=lambda x:len(x)) s='' s1=b[0] for 阅读全文
摘要:
def reverse(x): if x>0: a=list(reversed(list(str(x)))) if a[0]=='0': b=int(''.join(a[1:])) if b<pow(-2,31) or b>pow(2,31)-1: return 0 else: return b e 阅读全文
摘要:
def __init__(self,name,age): self.name=name self.age=agedef hello(self): print ('%s is saying hello...' %self.name)Foo=type('Foo',(object,),{'hello':h 阅读全文
摘要:
class hero1(object): camp='A' def __init__(self,nickname,attack1,life_value): self.nickname=nickname self.attack1=attack1 self.life_value=life_value d 阅读全文