File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ Composite-----------------
88Decorator-----------------
99Facade-------------------- Car
1010Factory Method------------
11- Flyweight-----------------
11+ Flyweight----------------- Look and feel eg widget style
1212Interpreter---------------
1313Iterator------------------ Iterating over a list backwards
1414Mediator------------------
Original file line number Diff line number Diff line change @@ -54,8 +54,19 @@ def calculate(self):
5454
5555#==============================================================================
5656if (__name__ == "__main__" ):
57- rect = Rectangle (4 , 5 )
58- print ("4 x 5 Rectangle area: %d" % (rect .area ()))
57+ x = 4
58+ y = 5
59+ rect = Rectangle (x , y )
60+ print (str (x ) + " x " + str (y ) + " Rectangle area: " + str (rect .area ()))
5961
60- tri = Triangle (4.0 , 5.0 );
61- print ("Base 4 height 5 Triangle area: %d" % (tri .area ()))
62+ base = 4
63+ height = 5
64+ tri = Triangle (base , height );
65+ print (
66+ "Base " +
67+ str (base ) +
68+ ", Height " +
69+ str (height ) +
70+ " Triangle area: " +
71+ str (tri .area ())
72+ )
Original file line number Diff line number Diff line change @@ -45,8 +45,8 @@ def __init__(self):
4545 print ("0" + str (i ) + " times: " + str (d .numbers ))
4646 d .save ()
4747 d .numbers .append (i )
48- d .save ()
4948 print ("10 times: " + str (d .numbers ))
49+ d .save ()
5050 print ("" )
5151
5252 # now undo repeat times
Original file line number Diff line number Diff line change 11# Targets
22TEX_NAME = Design_Patterns_In_Python
33
4+ # ==============================================================================
5+ all : open
6+ @true
7+
48# ==============================================================================
59test : FRC
610 @for program in * .py; \
You can’t perform that action at this time.
0 commit comments