What is eval in Python?
x = 5y = 10expr = "x + y"result = eval(expr)print(result)
In this example, we define two variables x and y, and a string expr that contains a Python expression. We then use eval() to evaluate the expression in expr, which adds x and y together. The result is stored in the variable result, which we then print to the console. The output of this program would be 15 important to note that eval() can be risky to use because it can execute any Python code that is passed to it as a string. This means that if you use eval() with untrusted input, it could potentially execute malicious code
Therefore, it's important to only use eval() with trusted input, or to sanitize any input before using it with eval()
Shortcut in Nepali :
Yedi kunai pani function ma int() ra float use garxam ra int ma float number haalyo vane error show garxa.
Example :
a = int(input("enter number"))
b = float(input("enter number"))
aba yo function ma a ko value ma 1, 2, 3 ya 4 diyo vane kunai pani error dekhaudaina tara a ko value hamile 1.5, 2.5 yestai float number diyeu vane error dekhaaunxa so yesto error nadekhaus jsto value diye pani aafai thaha paayos vanera hamile eval() ko use garinxa.
