1 #-*- coding : utf-8 -*-
2 import math 3 4 def move(x, y, step, angle=0): 5 nx = x + step * math.cos(angle) 6 ny = y - step * math.sin(angle) 7 return nx, ny
新建Python文件,保存为move,Python交互界面,导入move函数后,执行函数,报错
后在执行函数前,输入
import math
执行函数,不报错
1 #-*- coding : utf-8 -*-
2 import math 3 4 def move(x, y, step, angle=0): 5 nx = x + step * math.cos(angle) 6 ny = y - step * math.sin(angle) 7 return nx, ny
新建Python文件,保存为move,Python交互界面,导入move函数后,执行函数,报错
后在执行函数前,输入
import math
执行函数,不报错