Discuss / Python / 汉诺塔~~~

汉诺塔~~~

Topic source
def move(n, a, b, c):
    if n > 1 :
        move(n-1, a, c, b);

    print('# ', a, '-->', c);

    if n > 1 :
        move(n-1, b, a, c);

move(3, 'A', 'B', 'C')

  • 1

Reply