Bit of this AND that .... Coecademy error


#1

x=0b1110&0b101
print int(bin(x),2)

Output window give 4 which is correct But Codecademy throws this:
Oops, try again. It looks like the value you printed isn't correct.

Surely I am missing something very obvious. Thanks in advance for any help.


#2

You're changing the binary to an integer before printing it. It's looking for binary.

print bin(0b1110 & 0b101)

#3

Many thanks for your help.


#4

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