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
執行函數,不報錯