<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: For-loop calendar help! in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/for-loop-calendar-help/m-p/372667#M29454</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Although I don't think this has anything to do with arcpy / ArcGIS, there is a module you could load called &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;calendar&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import calendar
print calendar.month(2014,2)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;results in:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-family:courier new;"&gt;&amp;nbsp;&amp;nbsp; February 2014&lt;BR /&gt;Mo Tu We Th Fr Sa Su&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp; 2&lt;BR /&gt; 3&amp;nbsp;&amp;nbsp; 4&amp;nbsp;&amp;nbsp; 5&amp;nbsp;&amp;nbsp; 6&amp;nbsp; 7&amp;nbsp;&amp;nbsp; 8&amp;nbsp;&amp;nbsp; 9&lt;BR /&gt;10 11 12 13 14 15 16&lt;BR /&gt;17 18 19 20 21 22 23&lt;BR /&gt;24 25 26 27 28&lt;BR /&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;sorry, but the formatting changes the output. So I added an image:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]31572[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;See for more functionality:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://docs.python.org/2.7/library/calendar.html?highlight=calendar#calendar" rel="nofollow noopener noreferrer" target="_blank"&gt;http://docs.python.org/2.7/library/calendar.html?highlight=calendar#calendar&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kind regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Xander&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 17:14:16 GMT</pubDate>
    <dc:creator>XanderBakker</dc:creator>
    <dc:date>2021-12-11T17:14:16Z</dc:date>
    <item>
      <title>For-loop calendar help!</title>
      <link>https://community.esri.com/t5/python-questions/for-loop-calendar-help/m-p/372665#M29452</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;sorry about how messy it is but I cant figure out a way to get the for-loop to work, everything is working but the the for-loop&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to print out the calendar&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt; 


#Define number of days in a month and put in a list.
days_array= [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

#Define month names
month_array= ['January' , 'February' , 'March' , 'April' , 'May' , 'June' , 'July' , 'August' , 'September' , 'October' , 'November' , 'December']

#Get user input until they choose to quit
while True:
 #prompt for month
 month_input= int(input("\nEnter the month (1-12): "))
 if(month_input==0):
&amp;nbsp; break
 #prompt for year
 year_input= int(input("\nEnter the year (after 1900): "))
 if(year_input&amp;gt;1900) :
&amp;nbsp; break
 #Determine what day January of this year starts
 #follow formula
 starting_day_of_year= int(((year-1901) + (year-1901)/4+2)%7) 
 #determine what day current month starts
 #align month with index
 month_input= month_input-1
 starting_day_of_month= int((starting_day_of_year + sum(days_array[0: month_input]))%7)
 #adjust for March-December of leap year
 if (month_input &amp;gt;=2 &amp;amp; year%4== 0):
&amp;nbsp; starting_day_of_month= int((starting_day_of_month +1)%7)
 #print month, name &amp;amp; date
 #for-loop print each date of the month&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 



 NEED HELP HERE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
 

for i in range(days_array)(month_array)
 r just (4), end = "")
 #print Feb 29th if necessary
 
 if (month_input== 1 &amp;amp; year%4==0 ):
&amp;nbsp; print ("&amp;nbsp; 29")

&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Feb 2014 22:41:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/for-loop-calendar-help/m-p/372665#M29452</guid>
      <dc:creator>sameryoussef</dc:creator>
      <dc:date>2014-02-18T22:41:24Z</dc:date>
    </item>
    <item>
      <title>Re: For-loop calendar help!</title>
      <link>https://community.esri.com/t5/python-questions/for-loop-calendar-help/m-p/372666#M29453</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Could you elaborate as to what this has to do with any of the Arc* platforms???&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Feb 2014 01:03:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/for-loop-calendar-help/m-p/372666#M29453</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2014-02-19T01:03:26Z</dc:date>
    </item>
    <item>
      <title>Re: For-loop calendar help!</title>
      <link>https://community.esri.com/t5/python-questions/for-loop-calendar-help/m-p/372667#M29454</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Although I don't think this has anything to do with arcpy / ArcGIS, there is a module you could load called &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;calendar&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import calendar
print calendar.month(2014,2)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;results in:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-family:courier new;"&gt;&amp;nbsp;&amp;nbsp; February 2014&lt;BR /&gt;Mo Tu We Th Fr Sa Su&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp; 2&lt;BR /&gt; 3&amp;nbsp;&amp;nbsp; 4&amp;nbsp;&amp;nbsp; 5&amp;nbsp;&amp;nbsp; 6&amp;nbsp; 7&amp;nbsp;&amp;nbsp; 8&amp;nbsp;&amp;nbsp; 9&lt;BR /&gt;10 11 12 13 14 15 16&lt;BR /&gt;17 18 19 20 21 22 23&lt;BR /&gt;24 25 26 27 28&lt;BR /&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;sorry, but the formatting changes the output. So I added an image:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]31572[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;See for more functionality:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://docs.python.org/2.7/library/calendar.html?highlight=calendar#calendar" rel="nofollow noopener noreferrer" target="_blank"&gt;http://docs.python.org/2.7/library/calendar.html?highlight=calendar#calendar&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kind regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Xander&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:14:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/for-loop-calendar-help/m-p/372667#M29454</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-11T17:14:16Z</dc:date>
    </item>
  </channel>
</rss>

