Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Scripting (Python,R,etc): Write a function, min_date(string), that has the input of XXXX-XX-XX where: The string represents a date in YYYY-MM-DD format. So, 1234-56-7 is invalid
Scripting (Python,R,etc):
Write a function, min_date(string), that has the input of XXXX-XX-XX where:
- The string represents a date in YYYY-MM-DD format. So, 1234-56-7 is invalid
- There is no need to check that this value is a valid date. So, 1234-56-78 is valid
- Only valid date inputs will be used to test this function (so you do not need to handle non-date inputs if you dont want to). So, your function will not have to run a value with 1234-56-78 as an input (unless you want it to).
This function gives the output of YYYY-MM-DD, where the output is the closest real date given the following rules:
- The digits are 0 to 7. So, the date 3456-09-12 is invalid
- No number is repeated. So, the date 1234-09-15 is invalid
- The output date is a valid date. So, the date 6035-12-40 is invalid
You are given the following functions (but are free to not use them):
Examples of output:
min_date(7654-01-22)
> 7654-01-23
min_date(2020-12-24)
> 2345-06-17
min_date(0001-01-01)
- 1345-06-27
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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