函数 -> 递归函数 -> 汉诺塔
def move(n, a, b, c):
if n == 1:
print('move', a, '-->', c)
else:
move(n-1, a, c, b)
move(1, a, b, c)
move(n-1, b, a, c)
move(4, 'A', 'B', 'C')
【1】move(4, a, b, c) - 会报错
# move(4, a, b, c) - 会报错,a、b、c是变量,'A'、'B'、'C'是字符
# 在def中,也就是定义函数的时候,def move(n, a, b, c)中的a, b, c是变量。
# 定义了函数之后,在调用函数move(4, 'A', 'B', 'C') 的时候,输入的是变量的值
# 变量n的输入值是4,变量a的值是A,输入A的时候因为A是字符,所以要加 ' '
#