Dec-14-2020, 05:45 PM
(Dec-14-2020, 04:58 PM)deanhystad Wrote: if n == 0 this code never runs:
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]If that code doesn't run, value_e and value_o are not defined. You would get the same error running this code in you IDE if the first time you called decrypt you passed n == 0. However if you call decrypt() with n != 0 it will define value_e and value_o in the global scope and a future decrypt() call with n == 0 will will give invalid results but not crash.
Now I see where it went wrong. Thanks a lot!