Baseball
Add news
News

What is the difference between int(input ()) and eval(input ()) ? | Sololearn: Learn to code for FREE!

0 10
+ 1Python codespython36th Oct 2020, 8:44 AMNoah Ayebu3 Answers+ 6eval will run any string as python codeint just turns input type to integer6th Oct 2020, 8:47 AMSlick+ 5int(input("2+5")) will return Error,eval(input("2+5")) will return 76th Oct 2020, 10:12 AMShadoff+ 4With 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....6th Oct 2020, 9:03 AMHBhZ_C

Comments

Комментарии для сайта Cackle
Загрузка...

More news:

Bulldog Barks and Bytes : Diamond Dawgs Baseball
Let's Go Tribe

Read on Sportsweek.org:

Other sports

Sponsored