I want to declare an array in python3. I tried but I got an error
Python 3.6.7 (default, Oct 22 2018, 11:32:17)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> ip_pb=[]
>>> ip_pb[0]="0111111100000000000000011110001"
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: list assignment index out of range
>>>
After,I did this,it is working
>>> ip_pb=[""]
>>> ip_pb[0]="0111111100000000000000011110001"
>>> print(ip_pb)
['0111111100000000000000011110001']
But,I am looking for an another method. If we don't know how many values in the array, we can't declare the array in above method.