Discuss / Python / NameError: name 'math' is not defined.

NameError: name 'math' is not defined.

Topic source

源代码是这样的:

#!/usr/bin/env python3

-- coding: utf-8 --

import math

def mov(x,y,step,angle=0): if not isinstance(x,y,angle,(int,float)): raise TypeError('bad operand type') nx = x + step math.cos(angle) ny = y + step math.sin(angle) return nx,ny

结果总是NameError: name 'math' is not defined. 有大神会一眼看穿法帮忙瞅一眼吗?谢谢!


  • 1

Reply