Merge pull request #1053 from michael-k/python

Use python examples that work
This commit is contained in:
Alexandru Dima 2018-09-06 15:18:07 +02:00 committed by GitHub
commit d8409c7f1f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 18 deletions

View file

@ -1,12 +1,13 @@
from banana import * import banana
class Monkey: class Monkey:
# Bananas the monkey can eat. # Bananas the monkey can eat.
capacity = 10 capacity = 10
def eat(self, N): def eat(self, n):
'''Make the monkey eat N bananas!''' """Make the monkey eat n bananas!"""
capacity = capacity - N*banana.size self.capacity -= n * banana.size
def feeding_frenzy(self): def feeding_frenzy(self):
eat(9.25) self.eat(9.25)
return "Yum yum" return "Yum yum"

View file

@ -1,12 +1,13 @@
from banana import * import banana
class Monkey: class Monkey:
# Bananas the monkey can eat. # Bananas the monkey can eat.
capacity = 10 capacity = 10
def eat(self, N): def eat(self, n):
'''Make the monkey eat N bananas!''' """Make the monkey eat n bananas!"""
capacity = capacity - N*banana.size self.capacity -= n * banana.size
def feeding_frenzy(self): def feeding_frenzy(self):
eat(9.25) self.eat(9.25)
return "Yum yum" return "Yum yum"