编写代码诗

时间:2012-06-06 06:19:06

标签: python

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

# 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])

感谢您的帮助

1 个答案:

答案 0 :(得分:1)

你定义了函数,而不是这里的类,所有这些函数最终都会返回None