Do conversion of one data type to othere follows any order in python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Do conversion of one data type to othere follows any order in python?

like integer is converted to float rather than float to integer.

31st Jul 2019, 5:15 AM
User Name
User Name - avatar
3 Answers
+ 1
Thanks
31st Jul 2019, 7:30 AM
User Name
User Name - avatar
0
As far as i remeber in C++ you cant implicit cast int to float but opposite is true.
31st Jul 2019, 7:25 AM
User Name
User Name - avatar
- 1
Nope. You can convert an integer to a float. Same with a lot of other data types There are limits though (string to float/int will raise an error), though you can convert an int to string
31st Jul 2019, 6:40 AM
Trigger
Trigger - avatar