Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackCoaching1:1 coaching with people at your target companiesSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Build my plan
Odd Number Function Logic
00:00
5 left

Odd Number Function Logic

EasyPython

Problem

CG Advisor Network needs a small utility that classifies integer values for validation and routing logic. Implement a function that determines whether a given integer is odd.

Return True when the input has an odd value and False when it has an even value. The function must work for positive numbers, negative numbers, and zero. An integer is odd when dividing it by 2 leaves a remainder of 1 or -1, depending on the language's remainder behavior. In Python, number % 2 == 1 correctly identifies positive odd values, while number % 2 != 0 handles both positive and negative odd values consistently.

Formal Specification

  • Input: One integer number.
  • Output: A Boolean. Return True if number is odd; otherwise, return False.
  • Do not convert the number to a string or inspect its digits.

Constraints

  • -10^18 <= number <= 10^18
  • The input is always a valid Python integer
  • Use O(1) extra space

Function Signature

def is_odd(number):
Interviewer

Your question is Odd Number Function Logic. Start with the requirements in the Question tab.

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.
CodePython 3
Sign up free to run your codeLog inLn 2
Run your code to see test output here.