015 வகை நெறிமாற்றம் (Type Conversion) - Comprehensive Python in Tamil
Code
REPL
❯ uv run python
Python 3.14.3 (main, Feb 3 2026, 15:32:20) [Clang 17.0.0 (clang-1700.6.3.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> int("5")
5
>>> int("5.5")
Traceback (most recent call last):
File "<python-input-1>", line 1, in <module>
int("5.5")
~~~^^^^^^^
ValueError: invalid literal for int() with base 10: '5.5'
>>> float("5.5")
5.5
>>> float("5")
5.0
>>> age = 29
>>> "Arun's age is " + age
Traceback (most recent call last):
File "<python-input-5>", line 1, in <module>
"Arun's age is " + age
~~~~~~~~~~~~~~~~~^~~~~
TypeError: can only concatenate str (not "int") to str
>>> "Arun's age is " + str(age)
"Arun's age is 29"
>>> age = 29.5
>>> "Arun's age is " + str(age)
"Arun's age is 29.5"
>>>