+ 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
3 Answers
+ 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
+ 4
𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥 I think help tells us about all the function of modules
27th Jun 2020, 7:42 AM
Arctic Fox
Arctic Fox - avatar
27th Jun 2020, 7:35 AM
Arctic Fox
Arctic Fox - avatar