+ 1

Can someone explane EVAL?

how it works? in example (1**2**3) transform to 1. dont understand. https://code.sololearn.com/cszg1xG6WMNf/?ref=app

8th Apr 2018, 1:38 PM
andrey
andrey - avatar
2 Respostas
+ 2
Eval function operate in the string "1**2**3"and output the result as mathematical operation.It will calculate 1**2 then the result is 1 again will be powered by 3 : 1**3 result 1.With a simple print function you can not doing this mathematical operation in string data type ,then we use eval .
8th Apr 2018, 2:52 PM
HBhZ_C
HBhZ_C - avatar
+ 2
thanks a lot!!!
8th Apr 2018, 3:53 PM
andrey
andrey - avatar