Program - Abortive statements in finally blocks


Topic: Program - Abortive statements in finally blocks

Solution

def try_finally1():
    try:
        print('in try:')
        print('do some stuff')
        float('abc')
    except ValueError:
        print('an error occurred')
    else:
        print('no error occurred')
    finally:
        print('always execute finally')
try_finally1()



List all Python Programs