+ 1
What is the difference between int(input ()) and eval(input ()) ?
Python codes
3 Answers
+ 6
eval will run any string as python code
int just turns input type to integer
+ 5
int(input("2+5")) will return Error,
eval(input("2+5")) will return 7
+ 4
With int(input()) this will be converted to integer data type so your input must be numbers not text/string by default input accept only string values and outputs a string data type.So use int to convert this string number to integer dtype.Instead eval will convert an operation done with numbers in string format to integer result so input will be integer.with int you can not perform operations like addition multiplication....