0
Why print ( int("2.5") + int("3.5") ) error?
5 Respostas
+ 3
Its because you can't convert "2.5" to an integer, here its trying to get an integer with value of 2.5 thats not possible. Use float instead
+ 3
Yep. You can convert an integer that is a String to float:
float("3") = 3.0
But you cannot convert a float that is a String to an integer:
int("2.5") : illegal. Will throw an exception
Here is a tutorial about type conversion. Might be helpful.
https://www.datacamp.com/community/tutorials/JUMP_LINK__&&__python__&&__JUMP_LINK-data-type-conversion
+ 1
thank you Soo much 😊
0
what language
0
python 3