Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """File for creating Person objects"""
- class Person:
- """Defines a Person class, suitable for use in a hospital context.
- Data attributes: name of type str
- age of type int
- weight (kg) of type float
- height (metres) of type float
- Methods: bmi()
- """
- def __init__(self, name, age, weight, height):
- """Creates a new Person object with the specified name, age, weight
- and height"""
- self.name = name
- self.age = age
- self.weight = weight
- self.height = height
- def bmi(self):
- """Returns the body mass index of the person"""
- return self.weight / (self.height * self.height)
- def status(self):
- """returns if someone is over weight normal or underweight"""
- bmi_value = self.bmi()
- if bmi_value < 18.5:
- return ("Underweight")
- elif bmi_value >= 18.5 and bmi_value < 25:
- return ("Normal")
- elif bmi_value >= 25 and bmi_value < 30:
- return ("Overweight")
- elif bmi_value >= 30:
- return ("Obese")
- class Car:
- """fuck
- fuck fuck
- fuck fuck fuck"""
- def __init__(self, model, year, speed=0):
- """asf"""
- self.model = model
- self.year = year
- self.speed = speed
- def accelerate(self):
- """sfa"""
- self.speed += 5
- def brake(self):
- """fas"""
- if self.speed <= 5:
- self.speed = 0
- else:
- self.speed -= 5
- def honk_horn(self):
- """beep"""
- model = self.model
- print("{} goes 'beep beep'".format(model))
- def __str__(self):
- """returns the string"""
- model = self.model
- year = self.year
- speed = self.speed
- template = ("{} ({}), moving at {} km/h.")
- return template.format(model, year, speed)
- 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):
- """prints determined on if it has horns or not"""
- if self.has_horns == True:
- name = self.name.upper()
- print("HI! MY NAME IS {}!".format(name))
- else:
- name = self.name
- print("Hi! My name is {}!".format(name))
- def collect_baranges(self, amount=1):
- """collect pussy"""
- if amount > 1:
- self.baranges += amount
- return self.baranges
- else:
- self.baranges += amount
- return self.baranges
- def eat(self):
- """eat pussy"""
- if self.baranges >= 1:
- self.baranges -= 1
- self.height += .1
- elif self.baranges < 1:
- print("I don't have any baranges to eat!")
- def feast(self):
- """destroy pussy"""
- if self.baranges >= 5:
- if self.has_horns == True:
- self.height = self.height * 1.5
- self.baranges -= 5
- return self.height, self.baranges
- elif self.has_horns == False:
- self.has_horns = True
- self.baranges -= 5
- return self.has_horns, self.baranges
- elif self.baranges < 5:
- print("I don't have enough baranges to feast!")
- def __str__(self):
- """returns the formatted string represent of the person object"""
- name = self.name
- height = self.height
- has_horns = self.has_horns
- horned = ("")
- if has_horns == True:
- horned = ("horned ")
- template = ("{} is a {:.2f} m tall {}blork!")
- return template.format(name, height, horned)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement