Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Even or Odd Check

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

Your question is Even or Odd 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

The GEICO Mobile claims experience receives numeric claim identifiers and needs a small utility to classify each identifier as "even" or "odd". Given one integer, determine its parity programmatically.

Formal Specification

Implement classify_parity(number).

  • Input: number, an integer.
  • Output: Return the string "even" if the integer is divisible by 2; otherwise, return "odd".
  • Zero is considered even. Negative integers must be handled correctly.

Constraints

  • -10^18 <= number <= 10^18
  • number is an integer
  • Return exactly "even" or "odd"

Function Signature

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