exec inside def is not working in python

Solutions on MaxInterview for exec inside def is not working in python by the best coders in the world