![]() ![]() When you pass any non-integer value as a string inside the int() method, you will get the following error: ValueError: invalid literal for int() with base 10. ![]() ![]() Recommended Read: Here’s a detailed discussion on Python’s built-in metod int() – Python int() Function ValueError: invalid literal for int() with base 10 However, we can pass an alternate value for bases like 2 for binary numbers and 16 for hexadecimal numbers. The base generally has a default value of 10 which is utilized for decimal numbers. In Python, the int() function is used to take a string or a number as the first argument and a contention base which signifies the format of the number. Before diving into the topic of our discussion, it is extremely important to understand the working principle of the int() method.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |