Hello buran,
this is acutally my code:
What am i doing wrong?
this is acutally my code:
class Chromosom(object): #Chromosom wird erstellt mit Fitness,Index, Chromosom def __init__(self, fitness, index, chromosom): self.fitness=fitness self.index=index self.chromosom= chromosom def myfunc(self): # Printe ein Chromosom print(self.fitness,self.index,self.chromosom ) def __repr__(self, fitness, index, chromosom): return "<a:%s, b:%s, c:%s, d:%s>" % (self.fitness, self.index, self.chromosom) class LKW(object): # Erzeuge LKW mit Uhrzeit def __init__(self, uhrzeit): self.uhrzeit=uhrzeit def __str__(self): return "<Test a:%s>" % (self.uhrzeit) population=[] p1= Chromosom(1,5,[123456]) print(p1) p2=LKW(12) print(p2) population.append(p1) population.append(p2) print(population)But when i print the population i get an error __repr__ missing 3 required positional arguments in line 25 print(p1)
What am i doing wrong?