+ 1

What does 2nd argument mean in converting to int()?

Code: print(int('0011',2)) Gives output : 3 Why can anyone tell me plz ? I knew int is used to convert to integer but what if 2nd argument is mentioned ?

27th Jun 2020, 7:26 AM
Nikhil Maroju
Nikhil Maroju - avatar
7 RĂ©ponses
+ 4
It is use to mention the base of 1st argument ,here it is binary(2)
27th Jun 2020, 7:35 AM
Abhay
Abhay - avatar
27th Jun 2020, 7:42 AM
Arctic Fox
Arctic Fox - avatar