blob: 924c6fba5e78165ae5079bfdc514c03a34f51c3e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
import datetime
class Animal:
def __init__(self):
self.birthday = datetime.datetime.now()
def move(self):
return "*moves*"
class Dog(Animal):
def speak(self):
return "woof"
class Cat(Animal):
def speak(self):
return "meow"
class Kitten(Cat):
"""nyaa~~~
"""
def speak(self):
return "meow (but cuter)"
kitten = Kitten()
with open("animals.txt", "w") as f:
f.write(kitten.speak())
|