-1

我有一段我正在为“代码诗歌”竞赛编写的 Python 代码,它应该没有错误,但我不确定它有什么问题。我很感激任何意见。

# Creation
def dustBit(mass, rotation, velocity):
    bitMass = mass
    bitRotation = rotation
    bitVelocity = velocity

def dustCloud(mass, rotation):
    mass = mass
    rotation = rotation

def Stir(dustBit1, dustBit2):
    cloudMass = dustBit1.mass + dustBit2.mass
    cloudRotation = dustBit1.velocity * dustBit2.velocity
    return  dustCloud(cloudMass, cloudRotation)

def Spark(dustCloud): return StellarObject(dustCloud.mass)

def Life (planet, seed): return None

dustBit1 = dustBit(8.3, 5.2, -7.1)
dustBit2 = dustBit(5.3, 3.2, 5.4)

Cloud = Stir(dustBit1, dustBit2)
Planets = []
for i in range(8):
    Planets[i] = Stir(Cloud, dustBit1)

Sol = Spark(Cloud)

Life(Planets[2])

谢谢您的帮助

4

1 回答 1

1

你在这里定义函数,而不是类,它们最终都会返回None

于 2012-06-06T06:25:19.377 回答