Write a Python function to check whether a given number is prime or not.
03 August 2024
Question
Write a Python function to check whether a given number is prime or not.
Answer
To determine if a given number is prime, we can create a Python function that checks for factors of the number. A prime number is only divisible by 1 and itself, so the function will need to test divisibility up to the square root of the number for efficiency.