@@ -0,0 +1,481 @@
+%22%22%22Factory Method pattern%0A%22%22%22%0A%0A%0Aclass _Car(object):%0A    pass%0A%0A%0Aclass _Bike(object):%0A    pass%0A%0A%0Adef factory_method(product_type):%0A    if product_type == 'car':%0A        return _Car()%0A    elif product_type == 'bike':%0A        return _Bike()%0A    else:%0A        raise ValueError('Cannot make: %7B%7D'.format(product_type))%0A%0A%0Adef main():%0A    for product_type in ('car', 'bike'):%0A        product = factory_method(product_type)%0A        print(str(product))%0A%0Aif __name__ == '__main__':%0A    main()%0A

Add Factory Method pattern