filter's question
import math def is_sqr(x): r=(math.sqrt(x)) return r*r==x print filter(is_sqr, range(1, 101))
--output:
[1, 4, 9, 11, 14, 16, 17, 21, 22, 25, 27, 30, 33, 34, 35, 36, 39, 41, 42, 44, 46, 47, 49, 53, 54, 55, 56, 57, 62, 64, 67, 68, 69, 70, 71, 74, 79, 81, 83, 84, 85, 86, 88, 90, 91, 93, 98, 99, 100]
if I delete 'int ' in line4 ,the output is wrong.