Created
June 20, 2017 20:02
-
-
Save JagDecoded/68e15b59401ca1b72a763b510ae7a9a1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import rockpaper | |
class Hero: | |
def __init__(self,name): | |
self.name=name | |
self.health=100 | |
def eat(self,food): | |
if (food=='apple'): | |
self.health-=100 | |
elif (food=='ham'): | |
self.health+=20 | |
bob=Hero('bob') | |
print (bob.health) | |
bob.eat('apple') | |
print(bob.health) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment