Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Alphabet class
- class Alphabet(object):
- def __init__(self, s):
- self.s = s
- def __str__(self):
- return "Before: " + str(self.s)
- #Define your Vowels class here
- class Vowels:
- def __init__(self,vowelList):
- self.vowelList = vowelList
- def __str__(self):
- return "Invoking the method in Vowels by passing the Alphabet objectnAfter: " + str(vowelList)
- def addVowels(self,a_obj):
- for letter in a_obj:
- if letter in 'aeiou':
- vowelList.append(letter)
- l = ','.join(vowelList)
- a1 = Alphabet('A,B,C,E,I')
- print a1
- b = Vowels(a1)
- b.addVowels(a1)
- print (a2)
Add Comment
Please, Sign In to add comment