Example:
string = "12.4"
x = int(string)
Just curious if there's a way to do this directly, or if you just have to convert to float then to int as 2 steps.
Example:
string = "12.4"
x = int(string)
Just curious if there's a way to do this directly, or if you just have to convert to float then to int as 2 steps.
x="12.4"
x=int(float(x))# this float(x) first converts the string x into float and
#then int() function converts now newly float x int int x