Advertisement
Guest User

loved you nick

a guest
May 22nd, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.13 KB | None | 0 0
  1. """File for creating Person objects"""
  2.  
  3. class Person:
  4. """Defines a Person class, suitable for use in a hospital context.
  5. Data attributes: name of type str
  6. age of type int
  7. weight (kg) of type float
  8. height (metres) of type float
  9. Methods: bmi()
  10. """
  11.  
  12. def __init__(self, name, age, weight, height):
  13. """Creates a new Person object with the specified name, age, weight
  14. and height"""
  15. self.name = name
  16. self.age = age
  17. self.weight = weight
  18. self.height = height
  19.  
  20. def bmi(self):
  21. """Returns the body mass index of the person"""
  22. return self.weight / (self.height * self.height)
  23.  
  24. def status(self):
  25. """returns if someone is over weight normal or underweight"""
  26. bmi_value = self.bmi()
  27.  
  28.  
  29. if bmi_value < 18.5:
  30. return ("Underweight")
  31. elif bmi_value >= 18.5 and bmi_value < 25:
  32. return ("Normal")
  33. elif bmi_value >= 25 and bmi_value < 30:
  34. return ("Overweight")
  35. elif bmi_value >= 30:
  36. return ("Obese")
  37.  
  38. class Car:
  39. """fuck
  40. fuck fuck
  41. fuck fuck fuck"""
  42.  
  43. def __init__(self, model, year, speed=0):
  44. """asf"""
  45. self.model = model
  46. self.year = year
  47. self.speed = speed
  48.  
  49. def accelerate(self):
  50. """sfa"""
  51. self.speed += 5
  52.  
  53. def brake(self):
  54. """fas"""
  55. if self.speed <= 5:
  56. self.speed = 0
  57. else:
  58. self.speed -= 5
  59.  
  60. def honk_horn(self):
  61. """beep"""
  62. model = self.model
  63. print("{} goes 'beep beep'".format(model))
  64.  
  65. def __str__(self):
  66. """returns the string"""
  67. model = self.model
  68. year = self.year
  69. speed = self.speed
  70. template = ("{} ({}), moving at {} km/h.")
  71. return template.format(model, year, speed)
  72.  
  73. class Blork:
  74. """Defines the Blork class.
  75. Data attributes: name of type str
  76. height (metres) of type float
  77. has_horns of type bool
  78. """
  79.  
  80. def __init__(self, name, height, has_horns=False, baranges=0):
  81. """Blork constructor"""
  82. self.name = name
  83. self.height = height
  84. self.has_horns = has_horns
  85. self.baranges = baranges
  86.  
  87. def say_hello(self):
  88. """prints determined on if it has horns or not"""
  89. if self.has_horns == True:
  90. name = self.name.upper()
  91. print("HI! MY NAME IS {}!".format(name))
  92. else:
  93. name = self.name
  94. print("Hi! My name is {}!".format(name))
  95.  
  96. def collect_baranges(self, amount=1):
  97. """collect pussy"""
  98. if amount > 1:
  99. self.baranges += amount
  100. return self.baranges
  101. else:
  102. self.baranges += amount
  103. return self.baranges
  104.  
  105.  
  106. def eat(self):
  107. """eat pussy"""
  108. if self.baranges >= 1:
  109. self.baranges -= 1
  110. self.height += .1
  111. elif self.baranges < 1:
  112. print("I don't have any baranges to eat!")
  113.  
  114. def feast(self):
  115. """destroy pussy"""
  116. if self.baranges >= 5:
  117. if self.has_horns == True:
  118. self.height = self.height * 1.5
  119. self.baranges -= 5
  120. return self.height, self.baranges
  121. elif self.has_horns == False:
  122. self.has_horns = True
  123. self.baranges -= 5
  124. return self.has_horns, self.baranges
  125. elif self.baranges < 5:
  126. print("I don't have enough baranges to feast!")
  127.  
  128. def __str__(self):
  129. """returns the formatted string represent of the person object"""
  130. name = self.name
  131. height = self.height
  132. has_horns = self.has_horns
  133. horned = ("")
  134. if has_horns == True:
  135. horned = ("horned ")
  136. template = ("{} is a {:.2f} m tall {}blork!")
  137. return template.format(name, height, horned)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement