Use of eval() in Python - Python eval function - int() vs eval() in Python - Python Programming

Publicado el: 17 febrero 2022
en el canal de: Learn Computer
21,505
618

We always use int () in python to covert string to integer. like
x=int(input("Enter No 1:"))
y=int(input("Enter No 2:"))
z=x+y
print("Sum:",z)

we can use eval() also in place of int() like
x=eval(input("Enter No 1:"))
y=eval(input("Enter No 2:"))
z=x+y
print("Sum:",z)


in this video we clear the doubt students faces between int() vs eval(). Use of eval() in Python will make python code more versatile. Python eval function returns value which you want like integer , float, list, tuple etc. in Python Programming all must clear the use of eval(). in short if you want to read multiple values use eval function in python.

visit website :
https://anacondapython.com/


En esta página del sitio puede ver el video en línea Use of eval() in Python - Python eval function - int() vs eval() in Python - Python Programming de Duración hora minuto segunda en buena calidad , que subió el usuario Learn Computer 17 febrero 2022, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 21,505 veces y le gustó 618 a los espectadores. Disfruta viendo!