import math #导入math包
defmove(x, y, step, angle=0):
nx = x + step * math.cos(angle) #math.cos 调用math中的函数
ny = y - step * math.sin(angle)return nx, ny #返回多个值def non(): #定义一个空函数 pass #pass可做占位符,假如未想好实现什么功能,可用pass占位,但是这里没有pass是错误的
# -*- coding: utf-8 -*-
def move(n, a, b, c): #汉诺塔函数 if n == 1:
print(a, '-->', c)
else:
move(n-1,a,c,b)
move(1,a,b,c)
move(n-1,b,a,c) move(3, 'A', 'B', 'C')
A --> C A --> B
C --> B
A --> C
B --> A
B --> C
A --> C