当我尝试导入任何内容或尝试修改 numpy 语句以导入除from numpy import arange以外的任何内容(如 from numpy import *)或添加任何其他导入语句时,我收到错误消息。
我也不能让我的半径随机浮动它说 r = random.uniform(0,2) AttributeError: 'builtin_function_or_method' 对象没有属性 'uniform'。
这是我尝试修改导入语句时遇到的错误:
Traceback (most recent call last):
line 13, in <module>
rate(5)
TypeError: rate() missing 3 required positional arguments: 'pmt', 'pv', and 'fv'
代码:
from visual import *
from math import cos,sin,pi
from numpy import arange
from random import *
s = sphere(pos=[1,0,0],radius=0.1,color = color.red)
s0 = sphere(pos=[0,0,0],radius=0.25,color = color.green)
for i in arange(0,100,0.1):
rate(5)
theta = randint(0,30)
r = randint(-2,2)
x = cos(theta)
y = sin(theta)
s.pos = [x,y,r]