+ 1

Can anyone explain this?

Why the answer is 3 Print(int("0011",2)

20th May 2020, 12:51 AM
Bruklin
Bruklin - avatar
5 Answers
+ 3
0011 = 3 binary 0011 is 3 in decimal. int() is given a second argument 2 to specify the binary base.
20th May 2020, 1:06 AM
Bahhaāµ£
Bahhaāµ£ - avatar
+ 1
Thanks for the comments everyone: This question was asked to me in yesterday's challenge
20th May 2020, 8:04 AM
Bruklin
Bruklin - avatar
0
Bruklin BahhašŸ§ It will return Syntax Error
20th May 2020, 3:13 AM
Prince Kumar
Prince Kumar - avatar
0
šŠš¢š¢š›šØ š†š”ššš²ššš„ of course with a missing parentheses and capital p in "Print" , it will not work. but you get the purpose of the question nevertheless.
20th May 2020, 3:35 AM
Bahhaāµ£
Bahhaāµ£ - avatar
0
BahhašŸ§ Yeah I know
20th May 2020, 3:37 AM
Prince Kumar
Prince Kumar - avatar