Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MyClass:
- def __init__(self,*args):
- self.Input = args
- def __add__(self,Other):
- Output = MyClass()
- Output.Input = self.Input + Other.Input
- return Output
- def __str__(self):
- Output = " "
- for Item in self.Input:
- Output += Item
- Output += " "
- return Output
- Value1 = MyClass("Red", "Green", "Blue")
- Value2 = MyClass("Yellow", "Purple", "Cyan")
- Value3 = Values1 + Values2
- print("{0}+{1}={2}".format(Value1,Value2,Value3))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement