Continental interview question

python code for prime number