Hello, I am having some difficulty with a problem through Grok Learning. I've been stuck on it for two days now. I think I'm close to a solution, but I'm not getting the in-between outputs as I need to. I tried using the range function but am given coordinates or some reason. So I won't post that code, and will post the one that is closest to what the possible answer could be.
Here is the question;
"The lift is broken! It can still go up and down, but doesn't display what floor it's at anymore, which is causing confusion for people trying to use it.
Write a program that will display the floor numbers on an elevator that is going up. Your program should read in the current floor and read in the destination floor, which will always be higher than the current floor. Your program should print out each of the floor numbers in-between."
What the outputs should to be;
Here is the question;
"The lift is broken! It can still go up and down, but doesn't display what floor it's at anymore, which is causing confusion for people trying to use it.
Write a program that will display the floor numbers on an elevator that is going up. Your program should read in the current floor and read in the destination floor, which will always be higher than the current floor. Your program should print out each of the floor numbers in-between."
What the outputs should to be;
example1 Current floor: 3 Destination floor: 6 Level 3 Level 4 Level 5 Level 6 example2 Current floor: 1 Destination floor: 2 Level 1 Level 2My current answer code is;
floor = int(input("Current floor: ")) dfloor = int(input("Destination floor: ")) while floor <= dfloor: if dfloor % floor == 0: print("Level", floor) floor = floor + 1 print('')However, my output comes to just the selected floors;
Current floor: 3 Destination floor: 6 Level 3 Level 6