S&P Global Interview Question

To write a code to give primary numbers using python