title: Python - drawing a flower with turtle by recursive function
body: <p>I am trying to draw a turtle-graphics flower with <code>num</code> petals. However, when I run my code I only get one single petal printed out. The error I get is under the <code>def flower(num, i = 1)</code> part of the code, but I am not sure how I can fix it.</p>
  
  <pre><code>import time
  from turtle import *
  
  pensize(2)
  pencolor("orange")
  bgcolor("green")
  fillcolor("blue")
  hideturtle()
  
  def halfPetal():
      forward(50)
      left(30)
      forward(75)
      left(30)
      forward(50)
      left(120)
  
  def petal():
      for i in range(2):
          halfPetal()
  
  def flower(num, i=1):
      if i==1:
          begin_fill()
          for i in range(num):
              petal()
              left(360/petal())
          end_fill()
  
  flower(12)
  time.sleep(10)
  </code></pre>