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
Validate Idempotent Linux Task Runner
00:00
5 left

Validate Idempotent Linux Task Runner

EasyPython

Problem

Given a list of Linux automation task results, implement a function that determines whether the automation run is safe and repeatable. Each task is represented as a dictionary with keys name, changed, rc, and check_rc, where changed is a boolean indicating whether the task modified the system, rc is the normal execution return code, and check_rc is the dry-run return code. Return True if every task succeeded in both modes and at least one task is idempotent, meaning its dry-run and normal execution agree on whether a change is needed; otherwise return False.

Constraints

  • 1 <= len(tasks) <= 10^4
  • Each task contains keys: name, changed, rc, check_rc
  • rc and check_rc are integers in the range [-255, 255]

Function Signature

def validate_task_run(tasks):
Interviewer

Your question is Validate Idempotent Linux Task Runner. 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.
Code
Sign up free to run your codeLog inLn 2
Run your code to see test output here.