I\'ve been trying to make an encryption and decryption system but I have run into a small error. Here is my code:
import sys
import pyperclip
d
Before run() add encrypted = None
local variable 'encrypted' might be referenced before assignment
is a warning generated by the linter.
This is because the linter sees that encrypted is assigned values inside two if conditions
if question.lower() == 'yes' or question.lower() == 'y':
and
elif question.lower() == 'no' or question.lower() == 'n':
however, the linter cannot know that these two if conditions are complementary to each other. So, considering the case when none of the conditions is true, the variable encrypted will end up uninitialized.
To get rid of this warning, you can simply initialize the variable before any of the if conditions with None value
if the else branch is executed then encrypted is not defined. The IDE doesn't know you call run() again.
Keep in mind this might lead to an infinite recursion so you should be using another control flow mechanism (try using a while loop that breaks when the input is valid)