-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathex40.py
46 lines (31 loc) · 974 Bytes
/
ex40.py
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#mystuff = {'apple': "I'm - APPLE"}
#class MyStuff(object):
# def __init__(self):
# self.tangerine = "Let run clumsily"
# def apple(self):
# print("I'm - THE SWEETEST APPLE!")
#thing = MyStuff()
#thing.apple()
#print(thing.tangerine)
#Dictionary method
#mustuff['apples']
#Method with module
#mystuff.apples()
#print(mystuff.tangerine)
#Method with class
#thing = MyStuff()
#thing.apples()
#print(thing.tangerine)
class Song(object):
def __init__(self, lyrics):
self.lyrics = lyrics
def sing_me_a_song(self):
for line in self.lyrics:
print(line)
happy_bday = Song(["Can I have your birthday",
"Expensive gifts to give,",
"But these spring nights"])
bulls_on_parade = Song(["Far, far away, who is grazing in the medow?",
"Drink, children, milk, you will be healthy!"])
happy_bday.sing_me_a_song()
bulls_on_parade.sing_me_a_song()