Elevator program in javascript and python