Loading...

Ordered Character Check

A easy Python interview practice problem on DataDriven. Write and execute real python code with instant grading.

Domain
Python
Difficulty
easy
Seniority
staff

Problem

Our state machine validator needs to verify that transitions follow the correct order. Write a function called all_before that takes a string of only 'A' and 'B' characters and returns True if every A comes before every B. Empty strings and single-character strings return True.

Practice This Problem

Solve this Python problem with real code execution. DataDriven runs your Python code in a sandboxed Docker environment and grades it instantly.