Hello coders, I am in a bit of a pickle and need some help. I am using python to solve this problem so far I was able to convert the string of characters into 8-bit binary notation using this code
def encodeMessage(message:str):
int_binaryFormat = int.from_bytes(message.encode(),"little")
binaryFormat = bin(int_binaryFormat)
#binaryFormat = 0b+'$binaryString' So next steb removes substrin 0b
binaryFormat =binaryFormat[2:]
the problem is well it has to be converted to 7-bit. for the rest of the problem I created a simple automaton that takes each character then creates an output based on the order. So I was able to pass the first test which is great but the rest fail since their is an extra zero cuz its 8bits. Any suggestions would be appreciated.
Hi! I am having issue with the Test case 3 where it expect a very different result from the actual binary result. Is this a bug or am I missing something.
hi @push44 , You have to check your function that convert the char to tab of binary.
The purpose of these puzzles is to find the solution in your own, take your time in it, that helps you to improve your coding skill and reflexion.
If not you can send to me your code to verfiy with you .
regards
hi @MedAyoub for quick reply. I am using format(ord(token), ā07bā) for converting characters into binary values. On individual level character conversion is perfect and my code is working fine with other three cases. So I am confused about what could be the problem?
Yes, I was confused because code is handling special characters correctly. The problem was with spaces which I realized later from your comment. Problem is solved now. Thanks!