请利用filter()过滤出1~100中平方根是整数的数

1 import math
2 def is_sqr(x):
3     return math.sqrt(x) % 1 == 0
4 print(list(filter(is_sqr, range(1, 101))))

猜你喜欢

转载自www.cnblogs.com/seperinna/p/9765634.html