Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Book.__init__() missing 5 required positional arguments

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: {}
Legs: {}
Place: {}
Move: {}
Weight: {}
Length: {}".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
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #missing #required #positional #arguments
ADD COMMENT
Topic
Name
8+2 =