How do I group all my functions in Python into one function?
<p>I am using the Turtles Module where I am creating a U.S. Flag. The user decides the size of the flag and with that size I will be using it to create the width and length. </p>

<p>I am trying to group/compress all of my subfunctions into one huge function so the user can simply type <code>Draw_USAFlag(t, w) ## T = turtle W = Size</code> and it will carry out the task of the 5 functions that I already have.</p>

<p>For example I have 2 subfunctions: <code>draw_rectangle(t, w)</code> and <code>draw_stripes (t, w) ;</code> I want to group these two subfunctions into one function that will be called <code>Draw_USAFlag(t, w)</code> where it will use the user inputted <code>size (w)</code> throughout all of the functions. Any help is greatly appreciated! Thanks!</p>

<p>Quite simply, make a function that calls the others:</p>

<pre><code>def draw_rectangle(t, w):
    # however you do this
    ...

def draw_rectangle(t, w):
    # however you do this
    ...

def Draw_USAFlag(t, w):
    draw_rectangle(t, w)
    draw_stripes(t, w)
</code></pre>

<p>This assumes they don't return anything, so whatever they do works by side-effects on some other object. If e.g. they return an image, this will need changing depending on the exact structure of your system.</p>

python