ungleich-learning-circle/balazs/python-the-hard-way/ex40/ex40.py

27 lines
500 B
Python

class Poem(object):
def __init__(self, lyrics):
# self.lyrics = lyrics
pass
def tell(self, ):
poem = lyrics
for line in poem: #self.lyrics:
print(line)
# drill 2, poem to var:
bday = ["Happy birthday",
" La LA",]
happy_bday = Poem(bday)
another_poem = Poem(["Roses are red, violets a blue",
"I should finish before the time runs out",
"Cows say moo"])
happy_bday.tell()
another_poem.tell()