Doesn't display the right number?


#1

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

Oops, try again. It looks like the value you printed isn't correct.

Expected Correct Value

n1 = "0b1110"
n2 = "0b101"

def bitwise_or(num1, num2):
    diff1 = ""
    new_num1 = []
    new_num2 = []
    new_num = []
    for c in num1:
        new_num1.append(c)
    for c in num2:
        new_num2.append(c)
    if len(num1) != len(num2):
        if len(num1) > len(num2):
            diff1 = "0" * (len(num1) - len(num2))
            for c in diff1:
                new_num2.append(c)
        if len(num1) < len(num2):
            diff1 = "0" * (len(num2) - len(num1))
            for c in diff1:
                new_num1.append(c)
    for i in range(len(new_num1)):
        if new_num1[i] == "1" or new_num2[i] == "1":
            new_num.append("1")
        else:
            new_num.append(new_num1[i])
    final = "".join(new_num)
    return final
    
print(bitwise_or(n1,n2))

#2

wow, this is so much code, I can offer you simpler solution just print () and use or | between bits


#3

But it says you should try making one without using that.