# Programming Homework 1: Generate Calendar

Programming Homework 1: Generate Calendar.(Program to Generate Calendar)

As you continue, nursingstudy.org has the top and most qualified writers to help with any of your assignments including how to manage stress in workplaces. All you need to do is place an order with us (Program to Generate Calendar).

## Programming Homework 1: Generate Calendar

### Program to Generate Calendar

```def calendar(n, s):
#this will convert string value to a corresponding integer
if s == "Su":
d = 0
elif s == "Mo":
d = 1
elif s == "Tu":
d = 2
elif s == "We":
d = 3
elif s == "Th":
d = 4
elif s == "Fr":
d = 5
elif s == "Sa":
d = 6

As you continue, nursingstudy.org has the top and most qualified writers to help with any of your assignments including how to manage stress in workplaces. All you need to do is place an order with us (Program to Generate Calendar)

print ("Su Mo Tu We Th Fr Sa")
for j in range(d):
print (" ", end = " "),
i = 1
while i <= n:
if i < 10:
print ("",i,end=" "),
else:
print(i,end=" "),
if(i + d) % 7 == 0:
print (" ")
i = i + 1

n = int(input("Input the number of days in the month (28-31): "))
s = input("Input the starting day (Su=Sun, Mo=Mon,...): ")
calendar(n,s)```

1b) Year 2020 Calendar

# Program to display 2020 calendar and User to enter the specific month to display

As you continue, nursingstudy.org has the top and most qualified writers to help with any of your assignments including how to manage stress in workplaces. All you need to do is place an order with us (Programming Homework 1: Generate Calendar ).

import calendar

yy = 2020 # year

### To take month input from the user

mm= int(input(“Enter year: “))

### display the calendar

print(calendar.month(yy, mm))

1c) A short program for January 2020 Calendar

As you continue, nursingstudy.org has the top and most qualified writers to help with any of your assignments including how to manage stress in workplaces. All you need to do is place an order with us (Programming Homework 1: Generate Calendar ).

``````# Program to display  Jan 2020 calendar
# importing calendar module
import calendar

yy = 2020  # year
mm = 1    #month
# the header will be January 2020
print(calendar.month(yy, mm))``````

2, loop over 30 days of September

def date_iter(year, month):
for i in range(1, calendar.monthlen(year, month) + 1):
yield date(year, month, i)

As you continue, nursingstudy.org has the top and most qualified writers to help with any of your assignments including how to manage stress in workplaces. All you need to do is place an order with us (Programming Homework 1: Generate Calendar ).

``````  for d in date_iter(2020, 9):
print(d)``````

b) Genialize your calendar to 100 year
days = [“su”, “mo”, “tu”, “we”, “th”, “fr”, “sa”]
months = [“January”, “February”, “March”, “April”, “May”,
“June”, “July”, “August”, “September”, “October”, “November”, “December”]

``````old_length_s = 0
length_current_month = 0
month_header = ""
title = ""

data = dict()
for year in range(startYear, endYear):
s = "|"
# data[year] = dict()
for month in months:
old_length_s = len(s)
s += " "
# data[year][month] = dict()
cal_data = subprocess.Popen("cal " + str(month) +
" " + str(year),shell=True, stdout=subprocess.PIPE)
week_loop = 0
for line in iter(cal_data.stdout.readline, b""):
if week_loop > 1: #this is after month name and day_names
char_num = 0
day = 0
date = ""
for c in line:
date += c
if char_num > 1: #every three characters
char_num = 0
if len(date.strip()) > 0: #somefields are blank in each month's first week
# data[year][month][int(date)] = days[day]
if days[day] is "su":
if int(date) < 10:

As you continue, nursingstudy.org has the top and most qualified writers to help with any of your assignments including how to manage stress in workplaces. All you need to do is place an order with us (Programming Homework 1: Generate Calendar ).

s += " * "
else:
s += " *  "
else:
s += " " + str(date.strip()) + " "
date = ""
day += 1
else:
char_num += 1
week_loop += 1
# print len(s)
if month is "February" and len(s) is 223:
s += "    "
s += " |"
if first_year is True:
length_current_month = len(s) - old_length_s
blankspace = (length_current_month/2) - len(month)/2
if len(month)%2 is not 0:
month_header += " "*blankspace + month + " "*(blankspace-1)
else:
month_header += " "*blankspace + month + " "*blankspace
if month is "June":
s += "|  " + str(year) + "  ||"
month_header += "            "
actual_title = str(startYear) + " to " + str(endYear-1)
title = " "*((len(s)-7)-(len(actual_title)/2 -1 )) + actual_title
# print s

As you continue, nursingstudy.org has the top and most qualified writers to help with any of your assignments including how to manage stress in workplaces. All you need to do is place an order with us (Programming Homework 1: Generate Calendar ).

if first_year is True:
first_year = False
print(title)
print("\n"*5)
print(month_header)
print("\n"*3)
for c in s:
if c is not "|":
dividing_line += "-"
decade_divider += "="
else:
dividing_line += c
decade_divider += c
if str(year)[-1] is "0":
print(decade_divider)
print("\n")
print(decade_divider)
else:
print(dividing_line)
print("\n")
print(s)
print("\n")
print(dividing_line)
print("\n"*2)
print("* = sunday")
print("\n"*2)
writer.close()

As you continue, nursingstudy.org has the top and most qualified writers to help with any of your assignments including how to manage stress in workplaces. All you need to do is place an order with us (Programming Homework 1: Generate Calendar ).``````

def Main():
print
startYear = int(sys.argv[1])
year_interval = int(sys.argv[2])
endYear = startYear + year_interval
getDaysData(startYear, endYear)

## Community Health Promotion Essay Examples

Nursingstudy.org has the top and most qualified writers to help with any of your assignments including how to manage stress in workplaces. All you need to do is place an order with us (Programming Homework 1: Generate Calendar).

A Page will cost you \$12, however, this varies with your deadline.

We have a team of expert nursing writers ready to help with your nursing assignments. They will save you time, and improve your grades.

Whatever your goals are, expect plagiarism-free works, on-time delivery, and 24/7 support from us.

Here is your 15% off to get started.
Simply:

• Place your order (Place Order
• Click on Enter Promo Code after adding your instructions
• Insert your code –  Get20

All the Best,

Cathy, CS