Therefore it can only convert the string representation of int, not the decimal or float or chars. The int() function uses the decimal number system as base conversion, meaning base=10 is the default value for transformation. One can think that while executing the above code, Python will automatically truncate the decimal value and retain only the integer part. ValueError: invalid literal for int() with base 10: '55.5' Print ("The weight of the person is:" str(kilos))įile "c:\Projects\Tryouts\listindexerror.py", line 2, in
0 Comments
Leave a Reply. |