Solución
solution.tsTypeScript
from contextlib import suppress
def safe_operation(should_fail: bool) -> str:
result = "done"
# Ignora ValueError si ocurre, sin usar try/except
if should_fail:
with suppress(ValueError):
pass
return result
0respuestas