daily pastebin goal
43%
SHARE
TWEET

name_binary.py

ihor_ks Nov 19th, 2018 76 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. #!/usr/bin/python3
  2.  
  3. #This program converts a user's name into a binary
  4. #representation. Example:
  5. #Тарас → '1000010001010000110000100010000001000011000010001000001'
  6.  
  7. name_string = input("Hello, what is your name?\n > ")
  8.  
  9. name_binary = ''.join(format(ord(letter), 'b') for letter in name_string)
  10.  
  11. print(f"Your name in binary representation: {name_binary}")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top