Solved Should I use datetime instead of slicing? SOSophieDevOP 1 Oct, 09:12 Slicing ISO timestamps feels fragile.
FRFreyaL1 Oct, 17:03 Solutionreplies: 2For real code, yes — datetime.fromisoformat() parses it properly (and since 3.11 it handles the trailing "Z"). This challenge is about practising slicing, and ISO 8601 is fixed-width, so slicing works reliably here.
Comments 4
Join the discussion CommentAlready have an account? Log in
For real code, yes —
datetime.fromisoformat()parses it properly (and since 3.11 it handles the trailing "Z"). This challenge is about practising slicing, and ISO 8601 is fixed-width, so slicing works reliably here.Good to know both options.
Slicing first, datetime later. Nice progression.
The "Mission elapsed time" challenge uses datetime later on.