title: Passing variables from for loop into another function in Python
body: <p>I am still very new to python. Please excuse any basic mistakes. I've been reading around and experimenting, but I haven't been able to get this to work.
  The main function in my script prints out all the dates in one year. I want to pass each date value into the next function (fun_Phase1) until all dates in the year have been processed.
  Any help would be greatly appreciated.</p>
  
  <pre><code>import requests
  import json 
  import calendar
  
  def fun_Phase1(_DATE):
      # Run additional code here
      print "You are in function Phase1 and the date is " + _DATE
  
  def fun_Main():
      cal = calendar.Calendar()
      for year in range(2015,2016):
          for month in range(1,13):
              monthdays = [d for d in cal.itermonthdays(year,month) if d != 0]
              for day in monthdays:
                  str_year = str(year)
                  if month &lt; 10:
                      str_month = "0" + str(month)
                      # print(str_month)
                  else:
                      str_month = str(month)
                      # print(str_month)
                  if day &lt; 10:
                      str_day = "0" + str(day)
                      # print(str_day)
                  else:
                      str_day = str(day)
                      # print(str_day)
                  _DATE = str_year + str_month  + str_day
                  # print(_DATE)
                  fun_Phase1(_DATE)
  
  # Execute the code
  fun_Main()
  </code></pre>
  
  <p>Thanks in advance.</p>