Focus mode

Python Temel

Stringlerde Casting

Stringlerde Casting


a = "5"


b = "5.3"


int(a)
5
float(b)
5.3
int(b)



---------------------------------------------------------------------------

ValueError                                Traceback (most recent call last)

<ipython-input-5-07ae29993d50> in <module>
----> 1 int(b)ValueError: invalid literal for int() with base 10: '5.3'


int(float(b))


5


Comments

You need to enroll in the course to be able to comment!