Jun-17-2019, 10:15 PM
Hi,
How can I iterate trough a phrase and convert each word to binary and then sum them? Is there a library/module for the alphabet/characteres?
How can I iterate trough a phrase and convert each word to binary and then sum them? Is there a library/module for the alphabet/characteres?
For instance: mystring = 'My beautiful house'
binout = ' '.join('{0:08b}'.format(ord(x), 'b') for x in mystring)
1st_word = 01001101
...
last_word = 01100101
total_phrase = 1st_word + ... + last_wordTIA
