.
<div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div bgcolor="#ffffff" text="#000000"><blockquote type="cite"><div>
<div class="h5">
      Thanks Christian for your links and code!!!!<br>
      <br>
      </div></div><pre><fieldset></fieldset>
_______________________________________________
Tutor maillist  -  <a href="mailto:Tutor@python.org" target="_blank">Tutor@python.org</a><div class="im">
To unsubscribe or change subscription options:
<a href="http://mail.python.org/mailman/listinfo/tutor" target="_blank">http://mail.python.org/mailman/listinfo/tutor</a></div></pre>
    </blockquote>
    <br>
    Below [1] is how I would write it, which is simply a re-factoring of
    your code so it&#39;s cleaner and more compact.  For calculating
    execution time you can use the `timeit` module [2] and for more
    in-depth analysis you can look at `profile` [3] and further to the
    bare-bones `dis` [4].<br>
    <br>
    [1]<br>
    &gt;&gt;&gt; def splitWord(word, number):<br>
    ...     x = []<br>
    ...     for y in xrange(0, len(word), number):<br>
    ...         x.append(word[y:y+number])<br>
    ...     return x<br>
    ...<br>
    &gt;&gt;&gt; splitWord(&#39;google&#39;, 1)<br>
    [&#39;g&#39;, &#39;o&#39;, &#39;o&#39;, &#39;g&#39;, &#39;l&#39;, &#39;e&#39;]<div class="im"><br>
    &gt;&gt;&gt; splitWord(&#39;google&#39;, 2)<br>
    [&#39;go&#39;, &#39;og&#39;, &#39;le&#39;]<br>
    &gt;&gt;&gt; splitWord(&#39;google&#39;, 3)<br>
    [&#39;goo&#39;, &#39;gle&#39;]<br></div>
    &gt;&gt;&gt; splitWord(&#39;google&#39;, 4)<br>
    [&#39;goog&#39;, &#39;le&#39;]<br>
    &gt;&gt;&gt; splitWord(&#39;google&#39;, 5)<br>
    [&#39;googl&#39;, &#39;e&#39;]<br>
    &gt;&gt;&gt; splitWord(&#39;google&#39;, 6)<br>
    [&#39;google&#39;]<br>
    &gt;&gt;&gt; splitWord(&#39;google&#39;, 7)<br>
    [&#39;google&#39;]<br>
    <br>
    [2] <a href="http://www.doughellmann.com/PyMOTW/timeit/" target="_blank">http://www.doughellmann.com/PyMOTW/timeit/</a><br>
    [3]
    <a href="http://www.doughellmann.com/PyMOTW/profile/index.html#module-profile" target="_blank">http://www.doughellmann.com/PyMOTW/profile/index.html#module-profile</a><br>
    [4] <a href="http://www.doughellmann.com/PyMOTW/dis/" target="_blank">http://www.doughellmann.com/PyMOTW/dis/</a><br><font color="#888888">
    <br>
    <div>-- <br>
      
      
      
      <p>Christian Witts<br>
        Python Developer<br>
        <br>
        <i></i></p>
    </div>
  </font></div>
</blockquote></div><br><br clear="all"><br>-- <br><a href="http://www.tricksfind.blogspot.com" target="_blank">www.tricksfind.blogspot.com</a><br><br>