class Rocket:
def __init__(self, name, mission):
self.__name = name
self.__mission = mission
def getMission(self):
return self.__mission
def addMission(self, mission):
# procedure method which adds a new mission. There can be one (str) or multiple (list) existing missions
I can't understand how to implement this addMission func within a class correctly.
Output should be something like this: Missions: ['Dragon 2 pad abort test', 'Dragon 2 in-flight abort test']. What I've "come up with" simply produces the right answer if that default input is placed, albeit it has the wrong inner mechanics. Thus, with different input it won't produce a thing:
self.__mission = [self.__mission, mission]
How do I... make it work?
question from:
https://stackoverflow.com/questions/65901140/pyprocedure-method-which-adds-a-new-mission 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…