Created
April 6, 2018 15:03
-
-
Save parzibyte/02a6c5551a40f172c331a7af36e6d95c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def obtener_representacion_ascii(caracter): | |
return ord(caracter) | |
def obtener_representacion_binaria(numero): | |
return bin(numero)[2:].zfill(8) | |
def obtener_lista_de_bits(texto): | |
lista = [] | |
for letra in texto: | |
representacion_ascii = obtener_representacion_ascii(letra) | |
representacion_binaria = obtener_representacion_binaria(representacion_ascii) | |
for bit in representacion_binaria: | |
lista.append(bit) | |
return lista | |
print("Hola en bits es") | |
print(obtener_lista_de_bits("Hola")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment