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
- 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)
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...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started