Advertisement
B1KMusic

Two's complement test

Feb 7th, 2015
402
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.12 KB | None | 0 0
  1. #!/usr/bin/env python3
  2.  
  3. def tc(n):
  4.     return ~n + 1
  5.  
  6. i = 5
  7. print("tc(%i) = %i" % (i, tc(i))) # Prints "tc(5) = -5"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement