You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Write a program that will simulate the way that an elevator works. More instuctions could be found in the file:
#We should receive an input always#User may write a number or out#If he writes number, we should write him you are on {number} floor#If he writes out, we should stop execution#Improvement:#The building has 20 floorswhileTrue:
answer=input("Which floor you want me to take you?")
ifanswer=="out":
print("Exiting...")
breakelse:
answer_floor=int(answer)
ifanswer_floor>=0andanswer_floor<=20:
print(f"You are on floor number {answer}")
else:
print(f"I can not take you to {answer_floor}")
#Great addition you can apply, the program should write "You are already on this floor", if you give the same floor number like the latest input