Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial



this program suppose to change the 6th bit with 0 if all previous 5 bits are 1, but i don't know where i am wrong . can anyone help me with this.

import re

bits = input('Please Enter bits to Perform operation:- ')

bits_list = []


count = 0

replace = 0

for x in bits_list:

    replace +=1

    if x =='1':

        count +=1

        if count == 6:

            bits_list[replace-1] == '0'

            count =0

    if x == '0':

        count =0


1 Answer

I don't really get what you're trying to achieve here, but this line:

 bits_list[replace-1] == '0'

looks like it should be assigning a value rather than doing another comparison (i.e. one equals sign = instead of two ==):

 bits_list[replace-1] = '0'