1

My code looks as follows:

startDates = ['2011-01-01','2012-01-01']
endDates = ['2013-01-01','2014-01-01']
theJuice = []

for startDate in startDates and endDate in endDates:
    start_date = startDate 
    end_date = endDate
    print start_date
    print end_date

I hope you can help me.

martineau
  • 119,623
  • 25
  • 170
  • 301
Mars
  • 105
  • 3
  • 8

1 Answers1

1

You can use zip(*iterables):

for startDate, endDate in zip(startDates, endDates):
    print startDate
    print endDate

Output:

2011-01-01
2013-01-01
2012-01-01
2014-01-01
DjaouadNM
  • 22,013
  • 4
  • 33
  • 55
  • 1
    Not sure what the value is in answering such a consistent duplicate with an inferior answer to the linked dupe. – miradulo Sep 30 '17 at 20:22