Skip to main content
5 events
when toggle format what by license comment
May 24, 2017 at 20:27 comment added user1685095 What's maybe surprising is that you can write [*range(n + 1)]
May 21, 2017 at 22:57 comment added David Foerster If you're into functional programming you could turn for i in range(2, n + 1): if is_prime[i]: into for i in filter(is_prime.__get__, range(2, n + 1)):.
May 21, 2017 at 22:38 comment added David Foerster The list comprehension [i for i in range(n + 1)] could be written better as list(range(n + 1)). You don't need string.join in print statements like that; print(*res, sep='\n') would be better.
May 21, 2017 at 22:34 comment added David Foerster If you're writing C++ code it would be more idiomatic to use the formatted stream output and input operators >> and << instead of printf and scanf. Otherwise +1.
May 21, 2017 at 16:29 history answered kraskevich CC BY-SA 3.0