1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
8090 [49]
3 years ago
14

Date Time Manipulation Exploration If you start from Jan 1st, 1757, and repeatedly add 8 days, until you hit 1800, how many time

s will it be a Monday? # YOUR CODE HERE def calcDays (): my_date = date(1757, 1, 1) m = 0 while my_date.year != 1800 : my_date = my_date + timedelta(days = 8) if my_date.isoweekday () == 1: m += 1 return m Make a function Once you have answered this question, convert your code into a generalized function. This function, call it count_weekdays should take: start_date: a start date (a datetime object) add_days : a number of days to add (an int) • stop_year: a stop year (an int) • weekday : a day to count, represented in isoweekday format (an int) It should return the number of weekday is that occur from the start date, until stop year, when adding add_days days.
Computers and Technology
1 answer:
zimovet [89]3 years ago
4 0

Answer:

from datetime import datetime, date, timedelta

def count_weekdays(start_date, add_days, stop_year, weekday):

   my_date = start_date

   m = 0  

   while my_date.year != stop_year:  

       my_date = my_date + timedelta(days = add_days)

       if my_date.isoweekday() == weekday:

           m += 1

   return m

date_val = date(1757,1,1)

try:

   date_val = datetime.fromisoformat(input("Enter date in the format yyyy-mm-dd: "))

except ValueError:

   print("Wrong isoformat string")

print(count_weekdays(date_val, 8, 1800, 1))

Explanation:

The datetime package of the python programming language has several time modules like the date, datetime, pytz, timedelta, etc, used to manipulate date and time in documents. The function count_weekdays has four parameters and returns the number of a specified weekday in a period of time.

You might be interested in
What is meant by check digit
Strike441 [17]

Answer:it is the last number in a general digit

Explanation:

6 0
3 years ago
Jorge is looking for information about the life of his favorite music artist, Ray Charles. Which type of resource(s) would provi
Bumek [7]
He could read a biography.
4 0
2 years ago
Which task can a company perform with intranets
Irina-Kira [14]

Answer:

C.) store data securely would be my choice

Hope This Helps!  Have A Nice Day!!

6 0
2 years ago
Kitchen Gadgets
Scilla [17]

Answer:

hehe

Explanation:

7 0
2 years ago
Specialized programs that allow particular input or output devices to communicate with the rest of the computer system are calle
In-s [12.5K]
Hi!

These programs which allow a peripheral device to interact with the rest of the computer system are going to be <em>device drivers.</em>

Hopefully, this helps! =)
3 0
3 years ago
Other questions:
  • Create a Python for loop script of exactly 2 lines of code that generates a sequence of integer numbers that start in zero and g
    12·1 answer
  • Find the cell address of first column and last row some one pls answer :'(​
    9·1 answer
  • Although the battery on your smartphone is fully charged, it drains quickly. In some instances when the phone shows that the bat
    12·1 answer
  • Home communication involves controlling systems such as heating, cooling, and security.
    11·1 answer
  • Complete the following table.
    6·1 answer
  • Direct Mapped Cache. Memory is byte addressable. Fill in the missing fields based upon the properties of a direct-mapped cache.
    6·1 answer
  • Implement a Python function with the signature Transfer(S, T) that transfers all elements from the ArrayStack instance S onto th
    13·1 answer
  • Can someone start me off with a short 2 or 3 paragraphs about the pros and cons of Microsoft Word, and if you can recommend a si
    12·1 answer
  • True/False: On the piano, middle C is located to the left of the 2 black keys in the middle.
    9·2 answers
  • Colorful bead bracelet in codehs
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!