P. 1
Source Code for Python Calendar - US Version

Source Code for Python Calendar - US Version

Views: 22|Likes:
Published by berthad33
Copy the code from page 3, paste in Notepad, and save as USpythonCalendar.py (All Files). Generate monthly calendar of any year by running the python script.
Copy the code from page 3, paste in Notepad, and save as USpythonCalendar.py (All Files). Generate monthly calendar of any year by running the python script.

More info:

Published by: berthad33 on May 05, 2010
Copyright:Traditional Copyright: All rights reserved
List Price: $3.00 Buy Now

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
Visibility:Private
See more
See less

01/03/2013

$3.00

USD

pdf

PYTHON CALENDAR

Ent er year ? ( yyyy) : 2010
J A N U A R Y
Su Mo Tu We Th Fr Sa
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
F E B R U A R Y
Su Mo Tu We Th Fr Sa
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28
M A R C H
Su Mo Tu We Th Fr Sa
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
A P R I L
Su Mo Tu We Th Fr Sa
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30
M A Y
Su Mo Tu We Th Fr Sa
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31
J U N E
Su Mo Tu We Th Fr Sa
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30
J U L Y
Su Mo Tu We Th Fr Sa
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
A U G U S T
Su Mo Tu We Th Fr Sa
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
S E P T E M B E R
Su Mo Tu We Th Fr Sa
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30
O C T O B E R
Su Mo Tu We Th Fr Sa
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
N O V E M B E R
Su Mo Tu We Th Fr Sa
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
D E C E M B E R
Su Mo Tu We Th Fr Sa
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
Pr ess <ent er > t o qui t .
# USpyt honCal endar . py
pr i nt ( " PYTHON CALENDAR" )
pr i nt ( )
mont h = ( " J A N U A R Y" , " F E B R U A R Y" , " M A R C H" , " A P R I L" ,
" M A Y" , " J U N E" , " J U L Y" , " A U G U S T" , " S E P T E M B E R" ,
" O C T O B E R" , " N O V E M B E R" , " D E C E M B E R" )
wkday = ( " Su" , " Mo" , " Tu" , " We" , " Th" , " Fr " , " Sa" )
daysI nMont h = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
y = i nt ( i nput ( " Ent er year ? ( yyyy) : " ) )
f = 2*( 13) + ( 3*( 13+1) / / 5) + ( y- 1) + ( ( y- 1) / / 4) - ( ( y- 1) / / 100) + ( ( y- 1) / / 400) + 2
count = ( f %7)
i f ( ( y%4 == 0 and y%100 ! = 0) or y%400 == 0) :
daysI nMont h[ 1] =29
el se:
daysI nMont h[ 1] =28
f or m, di mi n zi p( mont h[ : ] , daysI nMont h[ : ] ) :
pr i nt ( ' \ n' )
pr i nt ( m)
f or wk i n wkday[ : ] :
pr i nt ( wk, end=" " ' ' )
pr i nt ( )

ski p=0
whi l e ski p < count :
pr i nt ( ' ' *3, end=" " )
ski p+=1
f or d i n r ange( 1, di m+1) :
pr i nt ( ' %2d' %d, end=" " ' ' )
count +=1
i f count == 7:
pr i nt ( )
count = 0

pr i nt ( ' \ n' *3)
i nput ( " Pr ess <ent er > t o qui t . " )

J U L Y Su Mo Tu We Th 1 4 5 6 7 8 11 12 13 14 15 18 19 20 21 22 25 26 27 28 29 A U G Su Mo 1 2 8 9 15 16 22 23 29 30 U S T Tu We 3 4 10 11 17 18 24 25 31 Fr 2 9 16 23 30 Sa 3 10 17 24 31 Th 5 12 19 26 Fr 6 13 20 27 Sa 7 14 21 28 S E P T E M Su Mo Tu We 1 5 6 7 8 12 13 14 15 19 20 21 22 26 27 28 29 B E R Th Fr 2 3 9 10 16 17 23 24 30 Sa 4 11 18 25 O C T O B E R Su Mo Tu We Th Fr 1 3 4 5 6 7 8 10 11 12 13 14 15 17 18 19 20 21 22 24 25 26 27 28 29 31 N O V Su Mo 1 7 8 14 15 21 22 28 29 E M B Tu We 2 3 9 10 16 17 23 24 30 E R Th Fr 4 5 11 12 18 19 25 26 E R Th Fr 2 3 9 10 16 17 23 24 30 31 Sa 2 9 16 23 30 Sa 6 13 20 27 D E C E M B Su Mo Tu We 1 5 6 7 8 12 13 14 15 19 20 21 22 26 27 28 29 Sa 4 11 18 25 Press <enter> to quit. .

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->