DEV Community

Cover image for Can anyone explain!

Can anyone explain!

Jahil tweets🥀🖤 on April 28, 2021

Can anyone explain me why we use this 2 in the code and if i change this 2 with anything else i get an error what is that??

Collapse
 
michaelfiber profile image
michaelfiber

The 0b prefix indicates that its a binary number. The int() command expects the second parameter to be the base of the number in the string. The base for a binary number is 2.