Hi, I am learning about stacks and I got a problem. When I type python3 -c 'import script; script.get_input()'
I am getting AttributeError: module ‘script’ has no attribute ‘get_input’
What did I wrong?
from stack import Stack
print("\nLet's play Towers of Hanoi!!")
#Create the Stacks
left_stack = Stack("Left")
middle_stack = Stack("Middle")
right_stack = Stack("Right")
stacks = [left_stack, middle_stack, right_stack]
#Set up the Game
num_disks = int(input("\n How many disks do you want to play with?"))
while num_disks < 3:
num_disks = int(input("Enter a number greater than or equal to 3\n"))
for i in range(num_disks, 0, -1):
left_stack.push(i)
num_optimal_moves = (2**num_disks) - 1
print("\nThe fastest you can solve this game is in {0} moves".format(num_optimal_moves))
#Get User Input
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("")