i face the problem, that everytime i am trying to move a disk im getting the “else” path of my last if function:
if from_stack.get_size() == 0: print("\n\nInvalid Move (Error: stack is empty). Try Again") elif to_stack.get_size() == 0 or from_stack.peek() < to_stack.peek(): disk = from_stack.pop() to_stack.push(disk) num_user_moves += 1 break else: print("\n\nInvalid Move (Error: larger disk on smaller disk). Try Again")
It seems like this one is always executing and i have no clue why … i compared it to the solution video and it should be the same.
Here is the full code:
Thanks a lot!