Python eval Function

Python eval() function evaluates its argument as an expression and executes it.

>>> x = 5
>>> eval("x + 10")
15
>>> s = "x + 12"
>>> eval(s)
17


















endmemo.com © 2024  | Terms of Use | Privacy | Home