# Tower of Hanoi Data Structures Exercise Problem with L M R functionality

``````from stack import Stack

print("\nLet's play Towers of Hanoi!!")

#Create the Stacks
stacks = []
left_stack = Stack("Left")
middle_stack = Stack("Middle")
right_stack = Stack("Right")
stacks += [left_stack, middle_stack, right_stack]

num_disks = int(input("\nHow may disks do you want to play with?\n"))

while num_disks < 3:
num_disks = int(input("Enter a number greater than or equal to 3\n"))

for disk in range(num_disks, 0, -1):
left_stack.push(disk)
# left_stack.print_items()

num_optimal_moves = (2 ** num_disks) - 1
print("\nThe fastest you can solve this game is in {0} moves.".format(num_optimal_moves))

# list comprehensions
# get a variable to hold the data.
# the left side is the operation or the expression that you want the values of the for loop to have to undergo once they have already gone through the for loops operation the final result and the new list created will be once both the for loops operation and the expression are fully run.
# in this case we say go into the stack class and use the get_name function in stack.py to get the names of the stacks. and than we specify with the 0 that we want the first letter of the stacks.
# after that we for loop our way through the stacks list and we get the left stack, middle stack, and right stack. so by the end of this we have "l,m,r"

def get_input():
choices = [stack.get_name()[0] for stack in stacks]

while True:

for i in range(len(stacks)):
name = stacks[i].get_name()
letter = choices[i]
print("Enter {0} for {1}".format(letter, name))
user_input = input("")
``````

output in terminal

``````Let's play Towers of Hanoi!!

How may disks do you want to play with?
4

The fastest you can solve this game is in 15 moves.

Enter L for Left
``````

I am expecting the output to say at the bottom

Enter L for Left
Enter M for Middle
Enter R for Right

I have copied the solution code to the best of my ability and I am still getting stuck. Can anyone assist?