Complete the dbda() function. Given a starting date and a number of days, dbda() should call either before() or after()
This problem has been solved!
Do you need an answer to a question different from the above? Ask your question!
Question:
- 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..
- 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)
Related Book For
Introduction to Management Science A Modeling and Cases Studies Approach with Spreadsheets
ISBN: 978-0078024061
5th edition
Authors: Frederick S. Hillier, Mark S. Hillier
View Solution
Create a free account to access the answer
Cannot find your solution?
Post a FREE question now and get an answer within minutes.
* Average response time.
Posted Date: September 12, 2023 01:12:58