Intermediate
Collect results and errors without crashing
risky(name) returns name.upper(), but raises ValueError for names that start with "bad". Write async def collect_all(names) that runs risky for every name together and returns one string per name, in order: "ok:<RESULT>" for a success or "error:<message>" for a failure.
It must never raise. For example ["a", "bad1", "c"] gives ['ok:A', 'error:bad1 is not allowed', 'ok:C'].
What Check tests
- Mixed names give ok and error strings in order
- All good names give only ok strings
- All bad names do not raise
- An empty list gives an empty list
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
main.py
Sign in to run your code.
Output
Press Run to see what your program prints.