Why do I get None after each result of the print statement?
I have never come across this while using the print statement or class instantiation...
Where is None coming from?
class Enemy:
life = 3
def attack(self):
print("ouch!")
self.life -= 1
def checkLife(self):
if (self.life <= 0):
print('dead!')
else:
print( str(self.life) + " lives left..." )
e1 = Enemy()
print( e1.checkLife() )
# 3 lives left...
# None
print( e1.attack() )
# ouch!
# None
print( e1.checkLife() )
# 2 lives left...
# None