The date written out
- O(1) · Trivial
- Free
- Python
- JavaScript
- lists
- indexes
- strings
Problem
A date arrives as a list of three numbers, always in this order:
[day, month, year].
Write a function that returns it as text, day first and with slashes between the three parts, the way a train ticket prints it: with [15, 3, 2024] you return "15/3/2024".
The numbers are copied as they come, with no padding: the 5th of March 2024 comes out as "5/3/2024", not as "05/03/2024".
Examples
The 15th of March
[15, 3, 2024] → "15/3/2024"
The 1st of December
[1, 12, 1999] → "1/12/1999"
A one-digit day
[5, 3, 2024] → "5/3/2024"
Besides these, the challenge has hidden tests that are revealed when you submit your solution.
You start with this
Python
def written_date(date):
passJavaScript
function writtenDate(date) {
}Solve this challenge
It opens in your browser, with the editor and the tests. It is free and you do not need an account to start.