Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Blork:
- """Defines the Blork class.
- Data attributes: name of type str
- height (metres) of type float
- has_horns of type bool
- """
- def __init__(self, name, height, has_horns=False, baranges=0):
- """Blork constructor"""
- self.name = name
- self.height = height
- self.has_horns = has_horns
- self.baranges = baranges
- def say_hello(self):
- """hqweqhwe"""
- hello = "Hi! My name is {0}!".format(self.name)
- if self.has_horns == True:
- print(hello.upper())
- elif self.has_horns == None:
- print(hello)
- else:
- print(hello)
- def __str__(self):
- """hqweqhwe"""
- if self.has_horns == True:
- return "{0} is a {1:.2f} m tall horned blork!".format(self.name, self.height)
- else:
- return "{0} is a {1:.2f} m tall blork!".format(self.name, self.height)
- def collect_baranges(number):
- """wjeqwenqw"""
- number = self.baranges
- if number == 0:
- self.baranges += 1
- else:
- self.baranges = self.baranges + number
- def eat(self):
- """qweqweqe"""
- if self.baranges > 0:
- self.baranges -= 1
- self.height += 0.1
- else:
- print("I dont' have any baranges to eat!")
- def feast(self):
- """Qweqweqwe"""
- if self.baranges >= 5:
- if self.has_horns == True:
- self.eight = self.height + (0.5 * self.height)
- if self.has_horns == False:
- self.has_hair = True
- else:
- print("I don't have enough baranges to feast!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement