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

Published: 17 February 2022
on channel: 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/


On this page of the site you can watch the video online Use of eval() in Python - Python eval function - int() vs eval() in Python - Python Programming with a duration of hours minute second in good quality, which was uploaded by the user Learn Computer 17 February 2022, share the link with friends and acquaintances, this video has already been watched 21,505 times on youtube and it was liked by 618 viewers. Enjoy your viewing!