I'm trying to do something like :
x = [1001, 0111, 1111]
I'm currently trying to do this as saving all values(decimal) in list arry and then trying to convert it to its binary notation using :
'{:04b}'.format(arry)
Stuck at how to add another element after i inserted one. I have tried to do using append() and + but append() is not going to work and using + will cause all the binary format to glue together, how i should achieve this. Thanks Edit :
x = []
x = '{:04b}'.format(10)
print(x)
k = '{:04b}'.format(2)
x.append(k)
Gives err:
Traceback (most recent call last):
File "append.py", line 6, in <module>
x.append(k)
AttributeError: 'str' object has no attribute 'append'
appendshould work if you were appending to the list and not to the string.xto astringon the 2nd line of your example code.