LLD - Design — Elevator System
Given this simplified elevator state machine code snippet, what is the final state after these events:
callElevator(), arriveFloor(), openDoor()?
states = ['Idle', 'Moving', 'DoorOpen']
current_state = 'Idle'
def callElevator():
global current_state
if current_state == 'Idle':
current_state = 'Moving'
def arriveFloor():
global current_state
if current_state == 'Moving':
current_state = 'DoorOpen'
def openDoor():
global current_state
if current_state == 'DoorOpen':
current_state = 'Idle'