Skip to content
CodeKruPro

One function, a good input and a bad input

Predict the outputEasy-MediumPython only
main.py
def parse(text):
    try:
        n = int(text)
    except ValueError:
        print("bad", text)
    else:
        print("good", n)
    finally:
        print("done", text)

parse("7")
parse("x")

Graded by exact match. Spaces at the ends of lines and blank lines at the end do not count.

to answer and keep your progress. Reading is free for everyone.