#深蓝海盗旗
import math
def is_sqr(x):
return math.sqrt(x)%2 == 1 or math.sqrt(x)%2 == 0
print filter(is_sqr, range(1, 101))
import math
def is_sqr(x):
return math.sqrt(x)%2 == 1 or math.sqrt(x)%2 == 0
print filter(is_sqr, range(1, 101))
2016-07-24
def calc_prod(lst):
def a():
n=1
for x in lst:
n=n*x
return n
return a
f = calc_prod([1, 2, 3, 4])
print f()
自己写的居然也对了~~哈哈
def a():
n=1
for x in lst:
n=n*x
return n
return a
f = calc_prod([1, 2, 3, 4])
print f()
自己写的居然也对了~~哈哈
2016-07-22
class Student(Person):
__slots__ = ('score')
def __init__(self,name,gender,score):
super(Student,self).__init__(name,gender)
self.score = score
__slots__ = ('score')
def __init__(self,name,gender,score):
super(Student,self).__init__(name,gender)
self.score = score
2016-07-22
def cmp_ignore_case(s1, s2):
if s1.upper()>s2.upper():
return 1;
else:
return -1;
if s1.upper()>s2.upper():
return 1;
else:
return -1;
2016-07-22