PYTHON: Program to Check if a Number is Prime.

Code-Parser
570 views

Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content

PYTHON: Program to Check if a Number is Prime.

If you're like me, then you might come across clashes on CodinGame where you need to check if a number is prime or not. In my case, I can never remember how to write the code.

Here is a simple function you can create to check if a number is prime:

PROGRAM: Defining 'isPrime()'

Try it for yourself by changing the code and test-lines above.

Conclusion:

We have defined a function isPrime() using 5 lines of code.

Happy Coding, Code-Parser

Open Source Your Knowledge: become a Contributor and help others learn. Create New Content