Hi,
If I execute the following code I will get the the output as 2. What I need is to execute the string str. Is there a way that I can execute the string str as it is, so I will get the output as 5.
If I execute the following code I will get the the output as 2. What I need is to execute the string str. Is there a way that I can execute the string str as it is, so I will get the output as 5.
Code:
def add(a,b):
return a+b
var = 2
str = "var = add(2,3)"
[color=#4080FF]# execute the code snippet inside the str string variable[/color]
print var
Comment