Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Complete the dbda() function. Given a starting date and a number of days, dbda() should call either before() or after() inside of a loop and

  1. Complete the dbda() function. Given a starting date and a number of days, dbda() should call either before() or after() inside of a loop and return the end date. A negative number of days should return a date before start_date, and a positive number should return a date after start_date.. 
  2. NOTE- THE SCRIPT BELOW IS MINE BUT WHEN I RUN MY CHECKING SCRIPT I GET AN ERROR. -  if int(str_date) >= 10:
    ValueError: invalid literal for int() with base 10: '2023-01-23'
     

def dbda(start_date: str, step: int) -> str:
   str_date = start_date

   if int(str_date) >= 10:
       for day in range(str_date):
           str_date = after(str_date)
   else:
       str_date = str_date * -1
       for date in range(str_date):
           str_date = before(str_date)

       end_date = str_date

       return end_date

   if __name__ == "__main__":

       if len(sys.argv) != 3:
         print("Use: assign1.py YYYY-MM-DD No")

   date = str(sys.argv[1])
   str_date = int(sys.argv[2])

   if valid_date(date):
     final_date = dbda(date,step)
     print(final_date)

Step by Step Solution

3.40 Rating (159 Votes )

There are 3 Steps involved in it

Step: 1

You are trying to convert the strdate to an integer but its a date in string format You should not c... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Management Science A Modeling And Cases Studies Approach With Spreadsheets

Authors: Frederick S. Hillier, Mark S. Hillier

5th Edition

978-0077825560, 78024064, 9780077498948, 007782556X, 77498941, 978-0078024061

More Books

Students also viewed these Programming questions

Question

Find the radius of convergence of? 1.2.3 1.3.5 (2n-1) r2n+1 -1

Answered: 1 week ago