Buku .__ init __ () hilang 5 argumen posisi yang diperlukan
class Animal:
def __init__(self, *, name, legs, place, move, weight, length, **kwargs):
super().__init__(**kwargs)
self.name = name
self.legs = legs
self.place = place
self.move = move
self.weight = weight
self.length = length
def __str__(self):
return "Name: {}\nLegs: {}\nPlace: {}\nMove: {}\nWeight: {}\nLength: {}".format(self.name, self.legs, self.place, self.move, self.weight, self.length)
def add_info(self):
info_name = input("Enter name")
info_legs = input("Enter how many legs this animal have")
info_place = input("Enter where this animal live")
info_move = input("Enter how move this animal")
info_weight = input("Enter Weight")
info_length = input("Enter length")
self.name = info_name
self.legs = info_legs
self.place = info_place
self.move = info_move
self.weight = info_weight
self.length = info_length
Proud Pintail