Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Error Handling in Robotic Arm Control

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

Your question is Error Handling in Robotic Arm Control. 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

In a robotic arm controller, it is crucial to manage error states to ensure patient safety. You are tasked with implementing a function that takes a list of error states and returns a list of safe commands that can be executed. Each error state is represented by an integer where positive values indicate safe commands and negative values indicate errors.

Input

  • A list of integers error_states where:
    • error_states[i] > 0 indicates a safe command.
    • error_states[i] <= 0 indicates an error state.

Output

  • A list of integers representing the safe commands.

Constraints

  • 1 <= error_states.length <= 1000
  • -1000 <= error_states[i] <= 1000

Function Signature

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