Back
Close

PYTHON: Program to Check if a Number is Prime.

Code-Parser
84 views

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

Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io