Tower of Hanoi, Struggling with the input function


I am doing the Computer Science course on Code Academy and am doing the Tower of Hanoi project. I got everything to work fine except that when I am playing the game I have to enter each input twice for it to work when I am selecting L M or R. Both when selecting the stack I am moving to and the stack I am moving from, I have to enter it twice. Can anyone provide any feedback on why that might be? I will post my code below:

from stack import Stack

#Get User Input – Problem must be in here

def get_input():

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

while input() != choices:

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("")

if user_input in choices:

  for i in range(len(stacks)):

    if user_input == choices[i]:

      return stacks[i]

As I mentioned above, the problem must be in the get_input(): function, as that is where the user is prompted to enter their desired input.

Could you possibly check the following details (and perhaps edit your original response) to follow the guidance at- FAQ: How to ask good questions and get good answers ( particularly the section on formatting code for the forums).