Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Prime Number Check

EasyPython00:00
Practice interviewer
In session
5 left
00:00

Your question is Prime Number Check. Start with the requirements on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

Write code to verify if a given number is prime.

Implement def is_prime(number):, returning True when number has exactly two positive divisors and False otherwise. Treat all integers less than 2 as non-prime. Return a boolean for every valid integer input.

Constraints

  • number is an integer
  • -10^9 <= number <= 10^9
  • Return a boolean value

Function Signature

def is_prime(number):
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output