Python TurtleGraphics - Smoothing out random walks?
<p>I need some help with this question relating to TurtleGraphics in Python:</p>

<p>A small detail of tipsy_turtle() is that when the turtle turns 90 degrees it immediately "jumps" to the new direction. This makes its movement seem jagged. It might look better if the turtle moved smoothly when turning. So, for this question, write a function called smooth_tipsy_turtle() that is the same as tipsy_turtle(), except instead of using the turtle.right(d) function, write a brand new function called smooth_right(d) that works as follows:</p>

<pre><code> - If d is negative then
      - repeat the following -d times:
            - turn left 1 using the ordinary turtle.left command

  - Otherwise, repeat the following d times:
          - turn right 1 using the ordinary turtle.right command
</code></pre>

<p>Here is my original function to get the random turtle movement:</p>

<pre><code>def tipsy_turtle(num_steps):
    turtle.reset()
    for step in range(num_steps):
       rand_num = random.randint(-1, 1)
       turtle.right(rand_num * 90)
       turtle.forward(5 * random.randint(1, 3))
</code></pre>

<p>So, how would I go about making this work? I tried adding:</p>

<pre><code>   if rand_num*90 &lt; 0:
       for step in range(rand_num*90):
           turtle.left(rand_num*90)
   else:
       turtle.right(rand_num*90)
</code></pre>

<p>But it didn't really work out and I don't know what I did wrong. Thanks!</p>
