Hello,
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]