class Rock:
def __init__(self, length, width):
self.length = length
self.width = width
def move(length):
length = length + 1
rock1 = Rock(100,300)
rock2 = Rock(300,500)
rocklist = [rock1,rock2]
gameover = 1
counter = 0
while gameover == 1:
for i in rocklist:
move(i.length)
print(length)
When running this, length remains the same, as demonstrated by the print. How can I change the values using a function?
length, noti.length, which should be causing aNameErrorsince it's undefined at that point.