0

How can I fix this error?!

My program is a bit compressor : For exemple, the user enter (10001101) the program output is (1302101) which means (1,triple0,two1,01). I have already a problem please check the program and see. https://code.sololearn.com/cRFWtmeBSplh/?ref=app

9th Aug 2018, 11:19 AM
Mohamed Sahnoun
Mohamed Sahnoun - avatar
4 Antworten
+ 3
User inputs 8 letters. Maximum index is 7. octet[i+7] tries to access index up to 22 because of your range(16). octet[15+7] #out of range Every single one goes out of range. Still with range(8). octet[7+7] #out of range octet[7 + 1] #out of range
9th Aug 2018, 5:55 PM
Toni Isotalo
Toni Isotalo - avatar
+ 1
Normally it's range 8 (8 numbers in the bit) but I changed it because the error said out of range
9th Aug 2018, 5:52 PM
Mohamed Sahnoun
Mohamed Sahnoun - avatar
0
Why is the range 16?
9th Aug 2018, 5:50 PM
SlowFast
SlowFast - avatar
0
Oh yeah my bad thx!
9th Aug 2018, 6:29 PM
Mohamed Sahnoun
Mohamed Sahnoun - avatar