Supported cryptocurrencies:
BTC BTC
BCH Bitcoin Cash
NANO NANO
XTZ Tezos
0.0002 BTC
EnglishNeed help with python error.

DESCRIPTION: I am having this error message: TypeError: sword() missing 1 required positional argument: 'self' class weapon(): def sword(self): print ('big sword') class armor(): def shield(self): print ('big shield') class tank(weapon, armor): pass m = tank m.sword() m.shield() Any ideas on what is the solution? Thanks!

ハイゼンベルク キラ 7 years ago
    Tags:


Ryan Bruce 7 years ago Correct
class weapon():

def sword(self):

print ('big sword')



class armor():

def shield(self):

print ('big shield')



class tank(weapon, armor):

pass



m = tank() <---- This is my change.



m.sword()

m.shield()



--Output--

big sword

big shield
DownsLot.BlogSpot.com 7 years ago
when it was coming?
Maerco 7 years ago
class weapon():

def sword(self):

print ('big sword')



class armor():

def shield(self):

print ('big shield')



class tank(weapon, armor):

pass



m = tank()



m.sword()

m.shield()





it's work on python 2.7

I think you simply miss () on m.tank()