import math
def is_sqr(x):
return math.sqrt(x)%1.0==0
print filter(is_sqr, range(1, 101))
def is_sqr(x):
return math.sqrt(x)%1.0==0
print filter(is_sqr, range(1, 101))
2015-12-08
class Fibs(object):
i=[0,1]
def __init__(self,num):
self.num=num
while len(Fibs.i)<=num:
Fibs.i.append(Fibs.i[-2]+Fibs.i[-1])
def __str__(self):
return '%s'%self.i
def __len__(self):
return len(self.num)
i=[0,1]
def __init__(self,num):
self.num=num
while len(Fibs.i)<=num:
Fibs.i.append(Fibs.i[-2]+Fibs.i[-1])
def __str__(self):
return '%s'%self.i
def __len__(self):
return len(self.num)
2015-12-07