String | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

String

I wrote the program, but she gave an error word=('00000') print(word) bit={ } bit[0]=word i=0 while 32: i+=1 #The start of block d=4 n=word[:d]+'1' bit[i]=n #The end of block print(bit) error: 00000 Traceback (most recent call last): File "source_file.py", line 13, in <module> bit[i]=n #The end of block MemoryError

20th Jun 2017, 12:28 PM
Kreez
Kreez - avatar
2 Answers
+ 7
while 32 is an infinite loop. Probably went out of memory during execution.
20th Jun 2017, 12:44 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 5
'while 32:' is equivalent to 'while True:', so you make an infinite loop ^^ I guees you would do 'while i < 32:' ;)
20th Jun 2017, 12:46 PM
visph
visph - avatar