Solution: Prime numbers
Calculating the prime numbers
examples/functional/primes_with_filter.py
n = 50 nums = range(2, n) for i in range(2, 1+int(n ** 0.5)): nums = filter(lambda x: x == i or x % i, nums) print(nums)
Calculating the prime numbers
n = 50 nums = range(2, n) for i in range(2, 1+int(n ** 0.5)): nums = filter(lambda x: x == i or x % i, nums) print(nums)