Programming Homework 1: Generate Calendar

A 1,082-word nursing paper examples, formatted in APA 7 (about 4 double-spaced pages).

Updated

Type
Nursing Paper Examples
Length
1,082 words, 4 pages
Style
APA 7
Contents (6 sections)
  1. Programming Homework 1: Generate Calendar
  2. Program to Generate Calendar
  3. importing calendar module
  4. To take month input from the user
  5. display the calendar
  6. Community Health Promotion Essay Examples

Nursing Paper ExamplesAPA 7

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

Program to Generate Calendar
Programming Homework 1: Generate Calendar 1
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 ).

importing calendar module

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

Capella University Health Promotion Plan And Best Practices PPTDiscussion: NURSFPX4060 Capella University Health Promotion Plan and Best Practices PPT Health Promotion Plan
Health Promotion Plan PresentationHealth Promotion Plan Presentation
Health Promotion and Community Resource Teaching ProjectIdentify interdisciplinary health professionals important to include in the health promotion. What is their role? Why is their involvement significant?
Identify a health problem or need for health promotion for a particular stage in the life span of a populationPURPOSE To apply concepts you have learned about health promotion concepts and strategies, enhance your written communication skills, and demonstrate a beginning understanding of cultural competency. 
Pender Health Promotion ModelPender Health Promotion Model(Program to Generate Calendar)

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).

Programming Homework 1: Generate Calendar

About the author

Dr. Rachel Andel publishes nursing paper examples on Nursing Paper Examples.

More papers by this author

This paper is a sample from a completed student assignment, published to help you understand structure, argument and APA formatting. Use it for inspiration and reference only, and cite it if you quote it.

Get this paper as a Word file

program-to-generate-calendar.docx, with an APA title page and reference list, ready to edit in Word or Google Docs.

Need a custom paper on Programming Homework 1: Generate Calendar?

Get an original, plagiarism-free paper written to your rubric by a nursing expert.

Get Writing Help from $12 per page

Cite This Paper

Pick your style, then copy. Italics are kept when you paste into Word or Google Docs.

Reference list

Nursing Paper Examples. (2022, November 9). Programming Homework 1: Generate Calendar [Nursing paper examples example]. https://nursingstudy.org/examples/program-to-generate-calendar/

In-text

(Nursing Paper Examples, 2022)

Published . Updated .

Cite this paper

Get the Word file

We'll email you program-to-generate-calendar.docx, formatted in APA and ready to edit.

We use your email to send this file, and offers only if you tick the box.

Get a paper like thisFrom $12 per page Get a price
Scroll to Top