Writing a for loop in python that has the <= (smaller or equal) condition in it?
<p>I want to iterate through different dates, for instance from 20/08/2015 to 21/09/2016, but I want to be able to run through all the days even if the year is the same. For instance 20/08/2015 to 25/09/2015.</p>

<p>Now if I write this in C, I could just use a for loop and make it so it runs if <code>value of startYear &lt;= value of endYear</code>, but from all the examples I see online the for loop runs with the range function, which means if I give it the same start and end values it will simply not run.</p>

<p>For example:</p>

<pre><code>startYear=int(raw_input("Starting year (yyyy):"));
endYear=int(raw_input("Ending year (yyyy):")); 
for year in range(startYear,endYear,1):
</code></pre>

<p>As the input comes from the user I have no control over it. So if <code>startYear</code> and <code>endYear</code> are both 2015 I can't make it iterate even once. Note that I can't "cheat" by changing the values of <code>startYear</code> and <code>endYear</code> as I am using the variable year for calculations later.</p>

<p>I would love to know:</p>

<ol>
<li>Is there a way to run a for loop in Python that checks for lower or equal?</li>
<li>What is the best way to go about writing this simple iteration?</li>
</ol>

<p>Thanks</p>