First, I apologize if this is not the right place for this.
I'm getting a code error when trying to Solve this task. I believe the error is because the "if in" and "if not in" conditions aren't triggering properly. I do pass the "Run" test, but not the "Check" test. I'm not certain what I am overlooking; maybe someone can point me in the right direction as to why the "if in" and "if not in" statements never trigger?
exclude = ['.:!?@$%']
class HackerLanguage:
def __init__(self):
self.text = ""
def write(self, text):
self.text += text
def delete(self, num):
self.text = self.text[:-num]
def send(self):
res = ""
for letter in self.text:
if letter not in exclude:
res += str(bin(ord(letter)))[2:]
else:
res += letter
return res
def read(self, rd):
self.rd = rd
res = ""
x = 0
while x < len(rd):
if rd[x] in exclude:
res += rd[x]
else:
res += chr(int(rd[x:x+7], 2))
x += 7
return res
Created at: 2021/07/20 22:01; Updated at: 2021/07/21 16:02
The question is resolved.