Programming Basics SQL HTML CSS JavaScript Python C++ Java JavaFX Swing Problem Solving English English Conversations Computer Fundamentals Learn Typing

ما هو حل الخطأ IndexError: list index out of range في بايثون؟

السلام عليكم، عند تنفيذ الدالة التالية يظهر لي خطأ.

def decrypt(self,block):
roundkeys = []
state = string2number(block)
for i in range(1, 31):
state = addRoundKey(state, roundkeys[-i-1])
state = pLayer_dec(state)
state = sBoxLayer_dec(state)
decipher = addRoundKey(state, roundkeys[0])
return number2string_N(decipher,8)
def decrypt(self,block): roundkeys = [] state = string2number(block) for i in range(1, 31): state = addRoundKey(state, roundkeys[-i-1]) state = pLayer_dec(state) state = sBoxLayer_dec(state) decipher = addRoundKey(state, roundkeys[0]) return number2string_N(decipher,8)

الخطأ الذي يظهر:

state = addRoundKey(state, roundkeys[-i-1])
IndexError: list index out of range
state = addRoundKey(state, roundkeys[-i-1]) IndexError: list index out of range

ما هو سبب الخطأ؟

تعليقات 1

أضف تعليق

يجب تسجيل الدخول حتى تتمكن من إضافة تعليق أو رد.