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 Antworten
+ 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