So i am writing this very simple encryptor and decryptor in python.I understand it procedural way but i want to make a class of it. Here is the code
class Encrypt():
def __init__(self,scentence):
self.scentence = scentence
def encryptor(self):
result = []
for letter in self.scentence:
l = ord(letter)+20
result.append(l)
for numbers in result:
print(numbers,end = '')
print(" " , end = '')
print(result)
def decryptor(result):
print(result)
end_string = ""
for j in result:
l = int(j)
l = l-20
l = chr(l)
end_string = end_string + l
print("The decrypted message is below:")
print(end_string)
f = Encrypt("helloe")
f.encryptor()
f.decryptor()
So when i run this code there is error as follows
for j in result: TypeError: 'Encrypt' object is not iterable
It would be very helpful for someone to explain the concept of SELF and OBJECT and CLASS