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


Lesson discussion

Swap insights and ask questions about Python Temel

Be the first to start the discussion

Ask a question or share your thoughts about this lesson.