Int's() second parameter


when we are writing this

print int("101",2)

than what is the significance of writing "2" in this...


The statement print int("101",2) gives 5 as output.
2 indicates that 101 is in binary format i.e in the form of 0s and 1s only. Int function will convert this binary number to decimal number. 5 is the decimal equivalent of 101.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.