Learn to code with step-by-step lessons. A place for students to work through programming fundamentals and build skills.
One possible program:
floor = 1
while True:
target = int(input("Go to floor (0 to stop): "))
if target == 0:
break
if target < 1:
print("Invalid floor.")
continue
floor = target
print("Now on floor", floor)
print("Elevator parked")