Simple Python code relating to prime numbers