Not printing the correct binary string


#1



Hello evryone :slight_smile:

https://www.codecademy.com/courses/python-intermediate-en-KE1UJ/2/2?curriculum_id=4f89dab3d788890003000096#

I get "Oops, try again. The correct binary string was not printed!
" as an error


Replace this line with your code. 

a = 0b110
mask = 0b100
desired = a | mask
a = desired 
print bin(a)


#2

You have changed the initial value of a. This is base code for this exercise:

a = 0b10111011

a = desired 
print bin(a)

Why not just:

print bin(desired)

?


#3

I thought the error part was due to the fact that I wasn't printing the right string. Forgot that I had edited the a string. Thanks for the help. :sweat_smile:


#4

You're very welcome :slight_smile:


#5

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