Back to Problem Solutions forum
Please help me. My solution:
def isWrong(s):
s = str(s)
if s.count('1') % 2 == 1:
return 'Wrong'
elif len(s) == 10 and s[2] == 1:
return int(s[:2] + s[3:], 2)
else:
return int(s, 2)
mes = [bin(int(x)) for x in input().split(' ')]
mes = list(map(isWrong, mes))
mes = [chr(x) for x in mes if x != 'Wrong']
print (''.join(mes))
This task is solved, but chars is wrong, despite digits is correct. What is wrong with chr()?
Hi,
I think chr() is doing what it should do. The problem description says ...
Answer should contain message with corrupted bytes removed, highest bits cleared - and represented as characters rather than numbers.
I can't see where you are "clearing the highest bit"
Thanks, man. It is really this problem :)
I cleared the highest bit, but I did forget ' ' and it would stay.
P.S. Sorry for my English