Write a class called MyString which has a function called "devowel" which returns the input string with no vowel
s = MyString("hello") s.devowel() # returns "hll"
Write a class called Player which starts with 100 health has 2 functions, hit and heal which hit and heal the player for some specified value. Once the players health to 0 or less, print out "he ded"
p = Player() p.hit(99) p.heal(20) p.hit(20) p.hit(1) # prints out "he ded"
Write a Python class named Circle constructed by a radius and which has two methods which will compute the area and the perimeter of a circle
c = Circle(5) c.perimeter() # prints out 2*pi*5 c.area() # prints out pi*5^2
Write 2 Python classs named Rectangle and Square, Rectangle should take in height and width and have a function to computer permeter and area. Square should inherit these functions from Rectangle and be constructed with just 1 paramater, x
r = Rectangle(1,2) r.area() # 2 r.perimeter() # 6 s = Square(2) s.perimeter() # 8 s.area() # 4