Advertisement
DeaD_EyE

train_wagon

Jul 13th, 2018
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.29 KB | None | 0 0
  1. class Wagon:
  2.     pass
  3.  
  4. class Train:
  5.     def __init__(self, wagons=None):
  6.         if wagons:
  7.             self.wagons = wagons
  8.         else:
  9.             self.wagons = []
  10.     def add_wagon(self, wagon):
  11.         self.wagons.append(wagon)
  12.  
  13. w1 = Wagon()
  14. train = Train()
  15. train.add_wagon(w1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement