Dec-20-2019, 10:52 AM
I did my best to get my goal, I didn't get the moveUp by adding 10.
this is my code
Rocket: Amanda Height: 10
Rocket: Atlast Height: 20
Rocket: Thores Height: 30
Rocket: Scoute Height: 40
Rocket: Domini Height: 50
what I need to do? to add height of 10 in every rocket
this is my code
class Rocket (): def __init__(self,name): self.name=name self.height=10 def moveUp (self): self.height+=10 nameOfRockets=['Amanda', 'Atlast', 'Thores', 'Scoute', 'Domini'] fleetOfRockets=[] for eachRocket in nameOfRockets: fleetOfRockets.append(Rocket(eachRocket)) for eachRocket in fleetOfRockets: eachRocket.moveUp() print('Rocket: '+ eachRocket.name + ' Height: ',eachRocket.height)this is my goal
Rocket: Amanda Height: 10
Rocket: Atlast Height: 20
Rocket: Thores Height: 30
Rocket: Scoute Height: 40
Rocket: Domini Height: 50
what I need to do? to add height of 10 in every rocket