Convert to number to float, int, and string in Python


Convert to float:

i = 72
float(i)
72.0

Convert to int:

int(i)
72

Convert to str:

str(i)
'72'



Ace your next data science interview

Get better at data science interviews by solving a few questions per week



Find a bug? Submit a suggested change on Github, or message me on Twitter.