Built-in function | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Built-in function

What excec function do in python?

30th Apr 2018, 10:36 AM
HBhZ_C
HBhZ_C - avatar
3 Answers
+ 3
exec() in Python exec() function is used for the dynamic execution of Python program which can either be a string or object code. If it is a string, the string is parsed as a suite of Python statements which is then executed unless a syntax error occurs and if it is an object code, it is simply executed. We must be careful that the return statements may not be used outside of function definitions not even within the context of code passed to the exec() function. It doesn;t returnn any value, hence returns None. Check this interactive tutorial: https://www.geeksforgeeks.org/exec-in-python/
30th Apr 2018, 8:31 PM
Johannes
Johannes - avatar
+ 2
You're welcome!
30th Apr 2018, 9:06 PM
Johannes
Johannes - avatar
+ 1
Thanks a lot Johannes
30th Apr 2018, 8:46 PM
HBhZ_C
HBhZ_C - avatar