Try it on paper first. A hint, the key idea and the worked solution are here when you need them.
The list ["2025", "10", "13"] holds a year, a month and a day. Write them as 2025-10-13, and then cut 2025-10-13 back into pieces.
join glues a list with a separator. split cuts at the separator.
Have you tried it?
Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, compare your working with the solution.
Use join with a hyphen: "-".join(["2025", "10", "13"]) gives 2025-10-13.
To cut it back, use split("-"): "2025-10-13".split("-") gives ["2025", "10", "13"].
Log in to join the discussion.
Loading…