n8thegr8702
n8thegr8702

Reputation: 1

__init__() missing 1 required positional argument: 'value' Will not change

class Dice:
    def __init__(self, sides = 6, value= None):
        self.sides = sides
        self.value = value
    def roll(self):
        self.value = randint(1, self.sides)
        return self.value
class greenDie(Dice):
  def __init__(self, sides, value):
        super().__init__(self, sides, value)
        super().__str__(self,value,faces)
  faces = {1: "🧠", 2: "🧠", 3: "🧠", 
             4:"👣", 5:"👣", 6:"💥"}

Later call

I keep on getting the error "init() missing 1 required positional argument: 'value'" no matter what changes I have made. I have looked at similar problems and tried to use their methods to fix my own, but they never work.

Upvotes: 0

Views: 176

Answers (2)

Elvin Jafarov
Elvin Jafarov

Reputation: 1467

Should be like below

    super().__init__(sides, value)

Upvotes: 0

Krishna Chaurasia
Krishna Chaurasia

Reputation: 9590

You don't need to explicit pass self while calling the class methods.

It should be:

super().__init__(sides, value)

Upvotes: 1

Related Questions