Example 1: Converting a Python String to an int:
Example 2: Converting a Python String to float:
Example 3: Converting a Python int to a String:
This is achieved by using str() function as shown below
100 is a 3 digit number 100200
Example 4: Converting a Python float to a String
This is achieved by using float() function as shown below
20.0is now a string 20.030.0
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.