Advertisement
jootiee

A2

Nov 18th, 2020
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.29 KB | None | 0 0
  1. number = int(input())
  2.  
  3. positive_binary = '0' + str(bin(number - 1))[2:]
  4. negative_binary = ''
  5.  
  6. for i in range(len(positive_binary)):
  7.     if positive_binary[i] == "0":
  8.         negative_binary += '1'
  9.     elif positive_binary[i] == '1':
  10.         negative_binary += '0'
  11.  
  12.  
  13. print(positive_binary, negative_binary)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement