Question: I'm getting an error that volume up() takes 1 positional argument but 2 were given class Volume: def __init__(self, volume=0): self.volume = 0 self.set(volume) def

I'm getting an error that volume up() takes 1 positional argument but 2 were given

class Volume:

def __init__(self, volume=0):

self.volume = 0

self.set(volume)

def __repr__(self):

return "Volume(" + str(self.volume) + ")"

def set(self, volume):

if volume < 0:

volume = 0

if volume > 11:

volume = 11

self.volume = volume

def get(self):

return self.volume

def up(self): self.set(self.volume + 1)

def down(self): self.set(self.volume - 1)

def __eq__(self, other):

return self.volume == other.volume

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!