Dec-14-2020, 03:21 PM
Note that this is happening in codewars and my IDE is not showing any errors.
here's the error:
Traceback (most recent call last):
File "main.py", line 12, in <module>
Test.assert_equals(decrypt("This is a test!", 0), "This is a test!")
File "/home/codewarrior/solution.py", line 14, in decrypt
for x in map(lambda x,y : x+y, value_o, value_e):
NameError: name 'value_o' is not defined
Thank you
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
def decrypt(text,n): i = 0 test = "" if n< 0 : text = text else : while i<n: for index,value in enumerate (text): global value_e value_e = [value for index, value in enumerate (text) if index< len (text) / 2 ] global value_o value_o = [value for index, value in enumerate (text) if index> = len (text) / 2 ] i + = 1 print (value_o) for x in map ( lambda x,y : x + y, value_o, value_e): test + = x |
Traceback (most recent call last):
File "main.py", line 12, in <module>
Test.assert_equals(decrypt("This is a test!", 0), "This is a test!")
File "/home/codewarrior/solution.py", line 14, in decrypt
for x in map(lambda x,y : x+y, value_o, value_e):
NameError: name 'value_o' is not defined
Thank you