Python program to execute a string containing Python code.
Topic: Python program to execute a string containing Python code.
Solution
mycode = 'print("hello world")' code = """ def multiply(x,y): return x*y print('Multiply of 2 and 3 is: ',multiply(2,3)) """ exec(mycode) exec(code)
List all Python Programs