Ad
  • Default User Avatar

    no the int() function converts from any number system to decimal. if you wanted to convert to, say, binary you'd have to use the bin() function.

  • Default User Avatar

    OHhh ok. Thank you for the expanation. Just one more question, is the output from the int function always in base 10 or is there a 3rd parameter we can give the function to output the convertion in other base systems?

  • Default User Avatar

    int converts a data type to integer. It can convert strings of numbers from other number base systems via the second optional input for the function. Eg: int("1001",2) == 9 because it is converting a base-2 string of numbers into denary. In this case, 16 was used because hexadecimal is a base-16 number system.

  • Default User Avatar

    Can anybody explain the role of int() here. I didn't know that int can take in more than one parameter. Sorry, new to programming here